def lx_config(args): args = parse_command_line(args, [], ['print', 'delete'], help=lixian_help.config) if args.delete: assert len(args) == 1 delete_config(args[0]) elif args['print'] or not len(args): if len(args): assert len(args) == 1 print get_config(args[0]) else: print 'Loading', global_config.path, '...\n' print source_config() print global_config else: assert len(args) in (1, 2) if args[0] == 'password': if len(args) == 1 or args[1] == '-': password = getpass('Password: '******'Saving password (encrypted) to', global_config.path put_config('password', encypt_password(password)) else: print 'Saving configuration to', global_config.path put_config(*args)
def lx_config(args): args = parse_command_line(args, [], ["print", "delete"], help=lixian_help.config) if args.delete: assert len(args) == 1 delete_config(args[0]) elif args["print"] or not len(args): if len(args): assert len(args) == 1 print get_config(args[0]) else: print "Loading", global_config.path, "...\n" print source_config() print global_config else: assert len(args) in (1, 2) if args[0] == "password": if len(args) == 1 or args[1] == "-": password = getpass("Password: "******"Saving password (encrypted) to", global_config.path put_config("password", encypt_password(password)) else: print "Saving configuration to", global_config.path put_config(*args)