<s> """<STR_LIT>""" <EOL> import os <EOL> import argparse <EOL> from pycclib . version import __version__ as cclibversion <EOL> import cctrl . common as common <EOL> from cctrl . output import get_version <EOL> from cctrl . settings import VERSION <EOL> from cctrl . user import UserController <EOL> def parse_cmdline ( user ) : <EOL> """<STR_LIT>""" <EOL> version = get_version ( VERSION , cclibversion ) <EOL> usage = '<STR_LIT>' <EOL> description = '<STR_LIT>' <EOL> epilog = "<STR_LIT>" <EOL> parser = argparse . ArgumentParser ( <EOL> description = description , <EOL> epilog = epilog , <EOL> usage = usage ) <EOL> parser . add_argument ( '<STR_LIT>' , '<STR_LIT>' , action = '<STR_LIT:version>' , version = version ) <EOL> subparsers = parser . add_subparsers ( <EOL> title = '<STR_LIT>' , <EOL> description = '<STR_LIT>' , <EOL> metavar = '<STR_LIT>' ) <EOL> create_subparser = subparsers . add_parser ( '<STR_LIT>' , help = "<STR_LIT>" ) <EOL> create_subparser . add_argument ( <EOL> "<STR_LIT>" , <EOL> nargs = <NUM_LIT:1> , <EOL> action = "<STR_LIT:store>" , <EOL> dest = "<STR_LIT:name>" , <EOL> help = "<STR_LIT>" ) <EOL> create_subparser . add_argument ( <EOL> "<STR_LIT>" , <EOL> nargs = <NUM_LIT:1> , <EOL> action = "<STR_LIT:store>" , <EOL> dest = "<STR_LIT:email>" , <EOL> help = "<STR_LIT>" ) <EOL> create_subparser . add_argument ( <EOL> "<STR_LIT>" , <EOL> nargs = <NUM_LIT:1> , <EOL> action = "<STR_LIT:store>" , <EOL> dest = "<STR_LIT:password>" , <EOL> help = "<STR_LIT>" ) <EOL> create_subparser . set_defaults ( func = user . create ) <EOL> setup_subparser = subparsers . add_parser ( '<STR_LIT>' , help = "<STR_LIT>" ) <EOL> setup_subparser . add_argument ( <EOL> "<STR_LIT>" , <EOL> action = "<STR_LIT:store>" , <EOL> dest = "<STR_LIT:email>" , <EOL> help = "<STR_LIT>" ) <EOL> setup_subparser . add_argument ( <EOL> "<STR_LIT>" , <EOL> action = '<STR_LIT:store>' , <EOL> choices = [ '<STR_LIT:yes>' , '<STR_LIT>' ] , <EOL> dest = "<STR_LIT>" , <EOL> default = None , <EOL> help = "<STR_LIT>" ) <EOL> setup_subparser . add_argument ( <EOL> "<STR_LIT>" , <EOL> action = "<STR_LIT:store>" , <EOL> dest = "<STR_LIT>" , <EOL> default = None , <EOL> help = "<STR_LIT>" ) <EOL> setup_subparser . set_defaults ( func = user . setup ) <EOL> activate_subparser = subparsers . add_parser ( <EOL> '<STR_LIT>' , <EOL> help = "<STR_LIT>" ) <EOL> activate_subparser . add_argument ( <EOL> '<STR_LIT>' , <EOL> nargs = <NUM_LIT:1> , <EOL> help = '<STR_LIT>' ) <EOL> activate_subparser . add_argument ( <EOL> '<STR_LIT>' , <EOL> nargs = <NUM_LIT:1> , <EOL> help = '<STR_LIT>' ) <EOL> activate_subparser . set_defaults ( func = user . activate ) <EOL> delete_subparser = subparsers . add_parser ( '<STR_LIT>' , help = "<STR_LIT>" ) <EOL> delete_subparser . add_argument ( <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> action = "<STR_LIT:store_true>" , <EOL> dest = "<STR_LIT>" , <EOL> help = "<STR_LIT>" ) <EOL> delete_subparser . set_defaults ( func = user . delete ) <EOL> listUsers_subparser = subparsers . add_parser ( <EOL> '<STR_LIT:key>' , <EOL> help = "<STR_LIT>" ) <EOL> listUsers_subparser . add_argument ( <EOL> '<STR_LIT:id>' , <EOL> nargs = '<STR_LIT:?>' , <EOL> help = '<STR_LIT>' ) <EOL> listUsers_subparser . set_defaults ( func = user . listKeys ) <EOL> addKey_subparser = subparsers . add_parser ( '<STR_LIT>' , help = "<STR_LIT>" ) <EOL> addKey_subparser . add_argument ( <EOL> '<STR_LIT>' , <EOL> nargs = '<STR_LIT:?>' , <EOL> default = os . path . expanduser ( '<STR_LIT>' ) , <EOL> help = '<STR_LIT>' ) <EOL> addKey_subparser . set_defaults ( func = user . addKey ) <EOL> removeKey_subparser = subparsers . add_parser ( <EOL> '<STR_LIT>' , <EOL> help = "<STR_LIT>" ) <EOL> removeKey_subparser . add_argument ( <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> action = "<STR_LIT:store_true>" , <EOL> dest = "<STR_LIT>" , <EOL> help = "<STR_LIT>" ) <EOL> removeKey_subparser . add_argument ( <EOL> '<STR_LIT:id>' , <EOL> nargs = <NUM_LIT:1> , <EOL> help = '<STR_LIT>' ) <EOL> removeKey_subparser . set_defaults ( func = user . removeKey ) <EOL> logout_subparser = subparsers . add_parser ( <EOL> '<STR_LIT>' , <EOL> help = "<STR_LIT>" ) <EOL> logout_subparser . set_defaults ( func = user . logout ) <EOL> check_token_subparser = subparsers . add_parser ( '<STR_LIT>' ) <EOL> check_token_subparser . set_defaults ( func = user . checktoken ) <EOL> registerAddon_subparser = subparsers . add_parser ( '<STR_LIT>' , help = "<STR_LIT>" ) <EOL> registerAddon_subparser . add_argument ( <EOL> '<STR_LIT>' , <EOL> help = '<STR_LIT>' ) <EOL> registerAddon_subparser . set_defaults ( func = user . registerAddon ) <EOL> args = parser . parse_args ( ) <EOL> common . run ( args , user . api , user . settings ) <EOL> def setup_cli ( settings ) : <EOL> api = common . init_api ( settings ) <EOL> try : <EOL> user = UserController ( api , settings ) <EOL> parse_cmdline ( user ) <EOL> except KeyboardInterrupt : <EOL> pass <EOL> finally : <EOL> common . shutdown ( api , settings ) </s>
