@@ -52,7 +52,7 @@ def resolve_project_id(client_secrets, credentials):
5252 raise click .ClickException ('Error loading client secret: %s.\n '
5353 'Run the device tool '
5454 'with --client-secrets '
55- 'or --project option.\n '
55+ 'or --project-id option.\n '
5656 'Or copy the %s file '
5757 'in the current directory.'
5858 % (e , client_secrets ))
@@ -65,7 +65,7 @@ def build_api_url(api_endpoint, api_version, project_id):
6565
6666
6767def build_client_from_context (ctx ):
68- project_id = (ctx .obj ['PROJECT ' ]
68+ project_id = (ctx .obj ['PROJECT_ID ' ]
6969 or resolve_project_id (ctx .obj ['CLIENT_SECRETS' ],
7070 ctx .obj ['CREDENTIALS' ]))
7171 api_url = build_api_url (ctx .obj ['API_ENDPOINT' ],
@@ -103,7 +103,7 @@ def pretty_print_device(device):
103103
104104
105105@click .group ()
106- @click .option ('--project' ,
106+ @click .option ('--project-id ' ,
107107 help = 'Enter the Google Developer Project ID that you want to '
108108 'use with the registration tool. If you don\' t use this flag, '
109109 'the tool will use the project listed in the '
@@ -113,8 +113,9 @@ def pretty_print_device(device):
113113 help = 'Enter the path and filename for the '
114114 '<client_secret_client-id.json> file you downloaded from your '
115115 'developer project. This file is used to infer the Google '
116- 'Developer Project ID if it was not provided with the --project '
117- 'flag. If the --project flag and this flag are not used, the '
116+ 'Developer Project ID if it was not provided with the '
117+ '--project-id flag. '
118+ 'If the --project-id flag and this flag are not used, the '
118119 'tool will look for this file in the current directory (by '
119120 'searching for a file named after the client_id stored in the '
120121 'credentials file).' )
@@ -134,7 +135,7 @@ def pretty_print_device(device):
134135 'API. You can use this flag if the credentials were generated '
135136 'in a location that is different than the default.' )
136137@click .pass_context
137- def cli (ctx , project , client_secrets , verbose , api_endpoint , credentials ):
138+ def cli (ctx , project_id , client_secrets , verbose , api_endpoint , credentials ):
138139 try :
139140 with open (credentials , 'r' ) as f :
140141 c = google .oauth2 .credentials .Credentials (token = None ,
@@ -148,7 +149,7 @@ def cli(ctx, project, client_secrets, verbose, api_endpoint, credentials):
148149 ctx .obj ['API_ENDPOINT' ] = api_endpoint
149150 ctx .obj ['API_VERSION' ] = ASSISTANT_API_VERSION
150151 ctx .obj ['SESSION' ] = None
151- ctx .obj ['PROJECT ' ] = project
152+ ctx .obj ['PROJECT_ID ' ] = project_id
152153 ctx .obj ['CREDENTIALS' ] = c
153154 ctx .obj ['CLIENT_SECRETS' ] = client_secrets
154155 logging .basicConfig (format = '' ,
@@ -207,13 +208,14 @@ def register(ctx, model, type, trait, manufacturer, product_name, description,
207208 hyphen (-), underscore (_), and plus (+). The device nickname can only
208209 contain numbers, letters, and the space ( ) symbol.
209210 """
210- # cache SESSION and PROJECT so that we don't re-create them between request
211+ # cache SESSION and PROJECT_ID
212+ # so that we don't re-create them between commands
211213 ctx .obj ['SESSION' ] = google .auth .transport .requests .AuthorizedSession (
212214 ctx .obj ['CREDENTIALS' ]
213215 )
214- ctx .obj ['PROJECT ' ] = (ctx .obj ['PROJECT ' ]
215- or resolve_project_id (ctx .obj ['CLIENT_SECRETS' ],
216- ctx .obj ['CREDENTIALS' ]))
216+ ctx .obj ['PROJECT_ID ' ] = (ctx .obj ['PROJECT_ID ' ]
217+ or resolve_project_id (ctx .obj ['CLIENT_SECRETS' ],
218+ ctx .obj ['CREDENTIALS' ]))
217219 ctx .invoke (register_model ,
218220 model = model , type = type , trait = trait ,
219221 manufacturer = manufacturer ,
@@ -398,7 +400,7 @@ def delete(ctx, resource, id):
398400def list (ctx , resource ):
399401 """Lists all of the device models and/or instances associated with the
400402 current Google Developer project. To change the current project, use the
401- devicetool's --project flag.
403+ devicetool's --project-id flag.
402404 """
403405 session , api_url , project_id = build_client_from_context (ctx )
404406 url = '/' .join ([api_url , resource ])
0 commit comments