From 0e9de1c924c2cfc064a071d07fcb3d8ce3b939f5 Mon Sep 17 00:00:00 2001 From: Seblu Date: Thu, 3 Feb 2011 18:02:42 +0100 Subject: [PATCH] --list-profile (-l) to list available profile quickly --login short become -L --- bin/cc-cli | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/bin/cc-cli b/bin/cc-cli index 1a2eed7..60f2b8d 100755 --- a/bin/cc-cli +++ b/bin/cc-cli @@ -44,7 +44,7 @@ try: help="Debug mode") oparser.add_option("-D", "--no-debug", action="store_false",dest="debug", help="Unset debug mode") - oparser.add_option("-l", "--login",action="store",dest="login", + oparser.add_option("-L", "--login",action="store",dest="login", help="Server login") oparser.add_option("-H", "--hostname",action="store",dest="server", help="Server hostname") @@ -54,6 +54,8 @@ try: help="Connection timeout") oparser.add_option("-p", "--profile",action="store",dest="profile", help="Profile name") + oparser.add_option("-l", "--list-profile", action="store_true",dest="proflist", + help="List available profile") oparser.add_option("--history-file",action="store",dest="history", help="History file") oparser.add_option("--history-size",action="store",dest="hsize", @@ -66,6 +68,12 @@ try: propath = "%s/profile"%BaseDirectory.save_config_path(cccli.canonical_name) fparser = ConfigParser.RawConfigParser() fparser.read(propath) + # profile listing + if options.proflist: + l = list(fparser.sections()) + l.remove("cli") + printer.out(os.linesep.join(l)) + sys.exit(0) # load default profile if fparser.has_section("cli"): settings.update(fparser.items("cli")) -- GitLab