From: Michael Tremer Date: Thu, 10 Mar 2011 16:20:28 +0000 (+0100) Subject: Allow to run a shell without a package. X-Git-Tag: 0.9.3~70^2~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=042266f382908aa59d5a5f4fcb4ff7a471ca88d4;p=pakfire.git Allow to run a shell without a package. --- diff --git a/pakfire/cli.py b/pakfire/cli.py index abf05bd59..84edbfb6c 100644 --- a/pakfire/cli.py +++ b/pakfire/cli.py @@ -246,7 +246,7 @@ class CliBuilder(Cli): # Implement the "shell" command. sub_shell = self.sub_commands.add_parser("shell", help=_("Go into a shell.")) - sub_shell.add_argument("package", nargs=1, + sub_shell.add_argument("package", nargs="?", help=_("Give name of a package.")) sub_shell.add_argument("action", action="store_const", const="shell") @@ -268,7 +268,6 @@ class CliBuilder(Cli): Cli.handle_info(self, long=True) def handle_build(self): - print self.args # Get the package descriptor from the command line options pkg = self.args.package[0] @@ -290,12 +289,14 @@ class CliBuilder(Cli): self.pakfire.build(pkg, arch=self.args.arch, resultdirs=[self.args.resultdir,]) def handle_shell(self): - print self.args + pkg = None + # Get the package descriptor from the command line options - pkg = self.args.package[0] + if self.args.package: + pkg = self.args.package[0] # Check, if we got a regular file - if os.path.exists(pkg): + if pkg and os.path.exists(pkg): pkg = os.path.abspath(pkg) if pkg.endswith(MAKEFILE_EXTENSION):