File tree Expand file tree Collapse file tree 5 files changed +117
-364
lines changed
Expand file tree Collapse file tree 5 files changed +117
-364
lines changed Original file line number Diff line number Diff line change 2121@click .version_option (__version__ , '-v' , '--version' )
2222@click .pass_context
2323def stackdio (ctx ):
24+ # Create a client instance
2425 client = StackdioClient ()
26+
27+ # Throw an error if we're not configured already
2528 if ctx .invoked_subcommand not in ('configure' , None ) and not client .usable ():
2629 raise click .UsageError ('It looks like you haven\' t used this CLI before. Please run '
2730 '`stackdio-cli configure`' )
2831
29- # Put the client in the obj
32+ # Put the client in the obj so other commands can pick it up
3033 ctx .obj = client
3134
3235
33- @stackdio .command ()
36+ @stackdio .command (name = 'configure' )
3437@pass_client
3538def configure (client ):
3639 """
3740 Configure the client
3841 """
39- click . echo ( 'configuring' )
42+ client . config . prompt_for_config ( )
4043
4144
42- @stackdio .command ('server-version' )
45+ @stackdio .command (name = 'server-version' )
4346@pass_client
4447def server_version (client ):
4548 """
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -26,25 +26,10 @@ class TimeoutException(Exception):
2626 pass
2727
2828
29+ # Create our decorator
2930pass_client = click .make_pass_decorator (StackdioClient )
3031
3132
32- # def pass_client(f):
33- # def new_func(*args, **kwargs):
34- # obj = click.get_current_context().obj
35- #
36- # if not isinstance(obj, dict):
37- # raise click.Abort('obj is not an instance of `dict`')
38- #
39- # client = obj.get('client')
40- #
41- # if not client or not isinstance(client, StackdioClient):
42- # raise click.Abort('No StackdioClient available')
43- #
44- # return f(client, *args, **kwargs)
45- # return update_wrapper(new_func, f)
46-
47-
4833def print_summary (title , components ):
4934 num_components = len (components )
5035
You can’t perform that action at this time.
0 commit comments