Commit 0e9de1c9 authored by Seblu's avatar Seblu
Browse files

--list-profile (-l) to list available profile quickly

--login short become -L
parent 2ae21f22
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -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"))