Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: cms/translations/xtm/cli.py

Issue 29969555: Issue 7039 - [XTM Integration] Make parameter naming consistent with the API docs
Patch Set: Created Dec. 28, 2018, 2:51 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | cms/translations/xtm/constants.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # This file is part of the Adblock Plus web scripts, 1 # This file is part of the Adblock Plus web scripts,
2 # Copyright (C) 2006-present eyeo GmbH 2 # Copyright (C) 2006-present eyeo GmbH
3 # 3 #
4 # Adblock Plus is free software: you can redistribute it and/or modify 4 # Adblock Plus is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License version 3 as 5 # it under the terms of the GNU General Public License version 3 as
6 # published by the Free Software Foundation. 6 # published by the Free Software Foundation.
7 # 7 #
8 # Adblock Plus is distributed in the hope that it will be useful, 8 # Adblock Plus is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
(...skipping 25 matching lines...) Expand all
36 try: 36 try:
37 api = XTMCloudAPI(read_token()) 37 api = XTMCloudAPI(read_token())
38 except Exception as err: 38 except Exception as err:
39 sys.exit(err) 39 sys.exit(err)
40 with create_source(args.source_dir, cached=True) as fs: 40 with create_source(args.source_dir, cached=True) as fs:
41 args.projects_func(args, api, fs) 41 args.projects_func(args, api, fs)
42 42
43 43
44 def generate_token(args): 44 def generate_token(args):
45 """Generate an API token from username and password.""" 45 """Generate an API token from username and password."""
46 username = input_fn('Username: ') 46 username = input_fn('Client name: ')
Vasily Kuznetsov 2019/01/04 20:21:14 Do you think it will be more clear to say "Client
Tudor Avram 2019/01/11 13:03:42 That was why I used `username` initially, but Wins
47 user_id = input_fn('User ID: ') 47 user_id = input_fn('User ID: ')
48 password = getpass.getpass(prompt='Pasword: ') 48 password = getpass.getpass(prompt='Password: ')
49 49
50 logging.info(const.InfoMessages.GENERATING_TOKEN.format(username, user_id)) 50 logging.info(const.InfoMessages.GENERATING_TOKEN.format(username, user_id))
51 try: 51 try:
52 token = get_token(username, password, int(user_id)) 52 token = get_token(username, password, int(user_id))
53 logging.info(const.InfoMessages.TOKEN_GENERATED.format(token)) 53 logging.info(const.InfoMessages.TOKEN_GENERATED.format(token))
54 54
55 cmd = const.Token.SAVE_COMMAND.format(const.Token.ENV_VAR, token) 55 cmd = const.Token.SAVE_COMMAND.format(const.Token.ENV_VAR, token)
56 sys.stdout.write(const.InfoMessages.TOKEN_SAVE_TO_ENV_VAR.format(cmd)) 56 sys.stdout.write(const.InfoMessages.TOKEN_SAVE_TO_ENV_VAR.format(cmd))
57 except XTMCloudException as err: 57 except XTMCloudException as err:
58 sys.exit(err) 58 sys.exit(err)
(...skipping 30 matching lines...) Expand all
89 project_create_parser.add_argument( 89 project_create_parser.add_argument(
90 '--name', required=True, 90 '--name', required=True,
91 help=const.ArgumentsHelp.ProjectCreate.NAME, 91 help=const.ArgumentsHelp.ProjectCreate.NAME,
92 ) 92 )
93 project_create_parser.add_argument( 93 project_create_parser.add_argument(
94 '--desc', required=True, 94 '--desc', required=True,
95 help=const.ArgumentsHelp.ProjectCreate.DESC, 95 help=const.ArgumentsHelp.ProjectCreate.DESC,
96 ) 96 )
97 97
98 project_create_parser.add_argument( 98 project_create_parser.add_argument(
99 '--client-id', required=True, type=int, 99 '--customer-id', required=True, type=int,
100 help=const.ArgumentsHelp.ProjectCreate.CLIENT_ID, 100 help=const.ArgumentsHelp.ProjectCreate.CUSTOMER_ID,
101 ) 101 )
102 project_create_parser.add_argument( 102 project_create_parser.add_argument(
103 '--ref-id', required=True, 103 '--ref-id', required=True,
104 help=const.ArgumentsHelp.ProjectCreate.REF_ID, 104 help=const.ArgumentsHelp.ProjectCreate.REF_ID,
105 ) 105 )
106 project_create_parser.add_argument( 106 project_create_parser.add_argument(
107 '--workflow-id', type=int, 107 '--workflow-id', type=int,
108 help=const.ArgumentsHelp.ProjectCreate.WORKFLOW_ID, 108 help=const.ArgumentsHelp.ProjectCreate.WORKFLOW_ID,
109 ) 109 )
110 project_create_parser.add_argument( 110 project_create_parser.add_argument(
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 args = parse_args() 157 args = parse_args()
158 158
159 if args.verbose: 159 if args.verbose:
160 logging.basicConfig(level=logging.INFO) 160 logging.basicConfig(level=logging.INFO)
161 161
162 args.func(args) 162 args.func(args)
163 163
164 164
165 if __name__ == '__main__': 165 if __name__ == '__main__':
166 main() 166 main()
OLDNEW
« no previous file with comments | « no previous file | cms/translations/xtm/constants.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld