* use OptionParser.print_help() properly
This commit is contained in:
@@ -45,8 +45,6 @@ class Command(object):
|
|||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
# now for the real parser
|
# now for the real parser
|
||||||
#usage_text = usage_text1 + commandsString() + usage_text2
|
|
||||||
#self.usage_text = usage_text
|
|
||||||
self.parser = OptionParser(usage=usage_text,
|
self.parser = OptionParser(usage=usage_text,
|
||||||
version="%prog " + pisi.__version__)
|
version="%prog " + pisi.__version__)
|
||||||
self.options()
|
self.options()
|
||||||
@@ -117,8 +115,7 @@ for that command.
|
|||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
if not self.args:
|
if not self.args:
|
||||||
print usage_text
|
self.parser.print_help()
|
||||||
print self.parser.format_option_help()
|
|
||||||
return
|
return
|
||||||
|
|
||||||
for arg in self.args:
|
for arg in self.args:
|
||||||
@@ -624,4 +621,5 @@ commands = {"help": Help,
|
|||||||
"list-repo": ListRepo
|
"list-repo": ListRepo
|
||||||
}
|
}
|
||||||
|
|
||||||
usage_text = usage_text1 + commandsString() + usage_text2
|
usage_text = (usage_text1 + commandsString() + usage_text2)
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -61,7 +61,7 @@ class PisiCLI(object):
|
|||||||
self.die()
|
self.die()
|
||||||
|
|
||||||
def die(self):
|
def die(self):
|
||||||
print usage_text
|
self.parser.print_help()
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
def runCommand(self):
|
def runCommand(self):
|
||||||
|
|||||||
+1
-1
@@ -247,7 +247,7 @@ def remove(A):
|
|||||||
if installdb.is_installed(x):
|
if installdb.is_installed(x):
|
||||||
operations.remove_single(x)
|
operations.remove_single(x)
|
||||||
else:
|
else:
|
||||||
ui.info('Package %s does not exist. Cannot remove.\n' % x)
|
ui.info('Package %s is not installed. Cannot remove.\n' % x)
|
||||||
|
|
||||||
return True # everything went OK :)
|
return True # everything went OK :)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user