Skip to content
This repository has been archived by the owner on Feb 22, 2024. It is now read-only.

Commit

Permalink
[pref] Change the entry point of pref CLI.
Browse files Browse the repository at this point in the history
Signed-off-by: Xiangyu Bu <[email protected]>
  • Loading branch information
xybu committed Jan 27, 2017
1 parent f2b9c82 commit 96f5df7
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions onedrived/od_pref.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,22 @@ def extract_qs_param(url, key):
context = load_context()


def main():
command_map = {
main_cmd: (change_account, change_config, change_drive),
change_account: (authenticate_account, list_accounts, delete_account),
change_config: (set_proxy, del_proxy, set_int_config, set_str_config, print_config),
change_drive: (list_drives, set_drive, delete_drive)
}
for cmd, subcmds in command_map.items():
for c in subcmds:
cmd.add_command(c)
main_cmd()


@click.group(context_settings=dict(help_option_names=['-h', '--help']))
@click.version_option(__version__)
def main():
def main_cmd():
pass


Expand Down Expand Up @@ -463,13 +476,4 @@ def del_proxy(protocol):


if __name__ == '__main__':
command_map = {
main: (change_account, change_config, change_drive),
change_account: (authenticate_account, list_accounts, delete_account),
change_config: (set_proxy, del_proxy, set_int_config, set_str_config, print_config),
change_drive: (list_drives, set_drive, delete_drive)
}
for cmd, subcmds in command_map.items():
for c in subcmds:
cmd.add_command(c)
main()

0 comments on commit 96f5df7

Please sign in to comment.