Loading bin/is +32 −0 Original line number Diff line number Diff line Loading @@ -317,6 +317,10 @@ def c_install(args): # select image to install repoman = load_repositories(args) image, repo = next(get_images([args.pattern], repoman, min=1, max=1)) if repo: # Print repo MOTD arrow("Repository %s MOTD" % repo.config.name) repo.motd() # Print setup information arrow(u"Installing %s v%s" % (image.name, image.version)) # let's go Loading @@ -337,6 +341,28 @@ def c_list(args): o_size=args.size, o_url=args.url, o_description=args.description) def c_motd(args): ''' Display (and edit) repository's MOTD ''' repoman = load_repositories(args) repo = repoman[args.repository] arrow("Current MOTD for %s:" % repo.config.name) repo.motd() if args.edit: # check local repository if not repo.local: raise ISError(u"Repository must be local") arrow("New MOTD (end with a blank line):") motd = "" # raw_input return bytestring data = raw_input().decode(sys.stdin.encoding) motd += data while data: data = raw_input().decode(sys.stdin.encoding) motd += u"\n%s" % data repo.motd(motd[:-1]) def c_move(args): ''' Move packaged image from a repository to another one Loading Loading @@ -627,6 +653,12 @@ def arg_parser_init(): p.add_argument("pattern", nargs="*", default=[], help="[repository/][image][:version]") p.set_defaults(func=c_list) # motd command parser p = subparser.add_parser("motd", help=c_motd.__doc__.lower()) p.add_argument("repository", help="repository to display/edit MOTD") p.add_argument("--edit", action="store_true", help="edit repository's MOTD") p.set_defaults(func=c_motd) # move command parser p = subparser.add_parser("move", help=c_move.__doc__.lower()) p.add_argument("-f", "--force", action="store_true", Loading completion/bash/is +7 −3 Original line number Diff line number Diff line Loading @@ -52,9 +52,9 @@ _is() { _get_comp_words_by_ref cur prev cword _get_first_arg cmds=('add' 'build' 'cat' 'changelog' 'check' 'chroot' 'clean' 'copy' 'del' 'extract' 'get' 'help' 'info' 'init' 'install' 'list' 'move' 'new' 'repo' 'search' 'version' 'diff' 'payload' 'prepare_chroot' 'unprepare_chroot', 'upgrade_db') 'extract' 'get' 'help' 'info' 'init' 'install' 'list' 'motd' 'move' 'new' 'repo' 'search' 'version' 'diff' 'payload' 'prepare_chroot' 'unprepare_chroot', 'upgrade_db') opts=('-h' '--help' '-V' '--version' '-v' '--verbosity' Loading Loading @@ -156,6 +156,10 @@ _is() { [[ "$cur" == -* ]] && _opt '-h --help -l --long -j --json -m --md5 -s --size -d --date -A --author -u --url -D --description' && return 0 _remote_image ;; motd) [[ "$cur" == -* ]] && _opt '-h --help --edit' && return 0 _repo ;; move) [[ "$cur" == -* ]] && _opt '-h --help -f --force' && return 0 _count_args Loading completion/zsh/_installsystems +6 −0 Original line number Diff line number Diff line Loading @@ -258,6 +258,12 @@ _is() { '*:image:_installsystems_remote_images' ) ;; (motd) args+=( '1:repository:_installsystems_repo' "--edit[edit repository's MOTD]" ) ;; (move) args+=( '(-f --force)'{-f,--force}'[move image without confirmation]' Loading doc/is.1.rst +7 −0 Original line number Diff line number Diff line Loading @@ -255,6 +255,13 @@ list [-h] [-A] [-d] [-D] [-j] [-l] [-m] [-s] [-u] [<remote_image>...] display image url motd [-h] [--edit] *repository* Display MOTD of a repository --edit edit the MOTD of the repository move [-h] [-f] <local_image>... *repository* Move one *image* (or more) to another *repository*. Loading installsystems/repository.py +28 −1 Original line number Diff line number Diff line Loading @@ -215,7 +215,7 @@ class Repository(object): ''' # check local repository if not self.local: raise ISError(u"Repository addition must be local") raise ISError(u"Repository must be local") try: arrow("Updating last file") last_path = os.path.join(self.config.path, self.config.lastname) Loading Loading @@ -584,6 +584,25 @@ class Repository(object): # Remove dummy repository shutil.rmtree(tmpdir) def motd(self, new_motd=None): ''' Display and edit repository motd ''' if new_motd is None: try: motd = self.db.ask("SELECT motd FROM repository").fetchone() except: motd = None if motd is None: raise ISError("Unable to retrieve %s's MOTD" % self.config.name) out(motd[0]) else: # check local repository if not self.local: raise ISError(u"Repository must be local") self.db.ask("UPDATE repository SET motd = ?", (new_motd,)) self.update_last() class Repository_v1(Repository): Loading Loading @@ -649,6 +668,14 @@ class Repository_v1(Repository): images.append(d) return images def motd(self, new_motd=None): ''' Display and edit repository motd ''' out('') if new_motd: warn("[%s] repository v1, unable to edit MOTD." % self.config.name) class RepositoryManager(object): ''' Loading Loading
bin/is +32 −0 Original line number Diff line number Diff line Loading @@ -317,6 +317,10 @@ def c_install(args): # select image to install repoman = load_repositories(args) image, repo = next(get_images([args.pattern], repoman, min=1, max=1)) if repo: # Print repo MOTD arrow("Repository %s MOTD" % repo.config.name) repo.motd() # Print setup information arrow(u"Installing %s v%s" % (image.name, image.version)) # let's go Loading @@ -337,6 +341,28 @@ def c_list(args): o_size=args.size, o_url=args.url, o_description=args.description) def c_motd(args): ''' Display (and edit) repository's MOTD ''' repoman = load_repositories(args) repo = repoman[args.repository] arrow("Current MOTD for %s:" % repo.config.name) repo.motd() if args.edit: # check local repository if not repo.local: raise ISError(u"Repository must be local") arrow("New MOTD (end with a blank line):") motd = "" # raw_input return bytestring data = raw_input().decode(sys.stdin.encoding) motd += data while data: data = raw_input().decode(sys.stdin.encoding) motd += u"\n%s" % data repo.motd(motd[:-1]) def c_move(args): ''' Move packaged image from a repository to another one Loading Loading @@ -627,6 +653,12 @@ def arg_parser_init(): p.add_argument("pattern", nargs="*", default=[], help="[repository/][image][:version]") p.set_defaults(func=c_list) # motd command parser p = subparser.add_parser("motd", help=c_motd.__doc__.lower()) p.add_argument("repository", help="repository to display/edit MOTD") p.add_argument("--edit", action="store_true", help="edit repository's MOTD") p.set_defaults(func=c_motd) # move command parser p = subparser.add_parser("move", help=c_move.__doc__.lower()) p.add_argument("-f", "--force", action="store_true", Loading
completion/bash/is +7 −3 Original line number Diff line number Diff line Loading @@ -52,9 +52,9 @@ _is() { _get_comp_words_by_ref cur prev cword _get_first_arg cmds=('add' 'build' 'cat' 'changelog' 'check' 'chroot' 'clean' 'copy' 'del' 'extract' 'get' 'help' 'info' 'init' 'install' 'list' 'move' 'new' 'repo' 'search' 'version' 'diff' 'payload' 'prepare_chroot' 'unprepare_chroot', 'upgrade_db') 'extract' 'get' 'help' 'info' 'init' 'install' 'list' 'motd' 'move' 'new' 'repo' 'search' 'version' 'diff' 'payload' 'prepare_chroot' 'unprepare_chroot', 'upgrade_db') opts=('-h' '--help' '-V' '--version' '-v' '--verbosity' Loading Loading @@ -156,6 +156,10 @@ _is() { [[ "$cur" == -* ]] && _opt '-h --help -l --long -j --json -m --md5 -s --size -d --date -A --author -u --url -D --description' && return 0 _remote_image ;; motd) [[ "$cur" == -* ]] && _opt '-h --help --edit' && return 0 _repo ;; move) [[ "$cur" == -* ]] && _opt '-h --help -f --force' && return 0 _count_args Loading
completion/zsh/_installsystems +6 −0 Original line number Diff line number Diff line Loading @@ -258,6 +258,12 @@ _is() { '*:image:_installsystems_remote_images' ) ;; (motd) args+=( '1:repository:_installsystems_repo' "--edit[edit repository's MOTD]" ) ;; (move) args+=( '(-f --force)'{-f,--force}'[move image without confirmation]' Loading
doc/is.1.rst +7 −0 Original line number Diff line number Diff line Loading @@ -255,6 +255,13 @@ list [-h] [-A] [-d] [-D] [-j] [-l] [-m] [-s] [-u] [<remote_image>...] display image url motd [-h] [--edit] *repository* Display MOTD of a repository --edit edit the MOTD of the repository move [-h] [-f] <local_image>... *repository* Move one *image* (or more) to another *repository*. Loading
installsystems/repository.py +28 −1 Original line number Diff line number Diff line Loading @@ -215,7 +215,7 @@ class Repository(object): ''' # check local repository if not self.local: raise ISError(u"Repository addition must be local") raise ISError(u"Repository must be local") try: arrow("Updating last file") last_path = os.path.join(self.config.path, self.config.lastname) Loading Loading @@ -584,6 +584,25 @@ class Repository(object): # Remove dummy repository shutil.rmtree(tmpdir) def motd(self, new_motd=None): ''' Display and edit repository motd ''' if new_motd is None: try: motd = self.db.ask("SELECT motd FROM repository").fetchone() except: motd = None if motd is None: raise ISError("Unable to retrieve %s's MOTD" % self.config.name) out(motd[0]) else: # check local repository if not self.local: raise ISError(u"Repository must be local") self.db.ask("UPDATE repository SET motd = ?", (new_motd,)) self.update_last() class Repository_v1(Repository): Loading Loading @@ -649,6 +668,14 @@ class Repository_v1(Repository): images.append(d) return images def motd(self, new_motd=None): ''' Display and edit repository motd ''' out('') if new_motd: warn("[%s] repository v1, unable to edit MOTD." % self.config.name) class RepositoryManager(object): ''' Loading