Skip to content

Commit b435633

Browse files
author
Clark Perkins
committed
Added configuration
1 parent c073542 commit b435633

File tree

5 files changed

+117
-364
lines changed

5 files changed

+117
-364
lines changed

stackdio/cli/__init__.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,25 +21,28 @@
2121
@click.version_option(__version__, '-v', '--version')
2222
@click.pass_context
2323
def 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
3538
def 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
4447
def server_version(client):
4548
"""

stackdio/cli/mixins/bootstrap.py

Lines changed: 0 additions & 307 deletions
This file was deleted.

stackdio/cli/utils.py

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,25 +26,10 @@ class TimeoutException(Exception):
2626
pass
2727

2828

29+
# Create our decorator
2930
pass_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-
4833
def print_summary(title, components):
4934
num_components = len(components)
5035

0 commit comments

Comments
 (0)