Skip to content

Commit

Permalink
small refact
Browse files Browse the repository at this point in the history
  • Loading branch information
mrprompt committed May 28, 2017
1 parent 253cd85 commit 9843379
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 12 deletions.
1 change: 1 addition & 0 deletions cli/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import json


def body(command, cmd, item):
if command == "repository" and cmd == "list":
body = [
Expand Down
1 change: 0 additions & 1 deletion cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
def cli():
pass


cli.add_command(user)
cli.add_command(server)
cli.add_command(environment)
Expand Down
4 changes: 1 addition & 3 deletions cli/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

output = StringIO()
pass_config = click.make_pass_decorator(Config, ensure=True)
header = ('ID', 'Repository ID', 'Environment ID', 'State', 'Version')


@click.group('deploy', short_help='Deploy commands')
Expand All @@ -22,7 +23,6 @@ def deploy_list(config, repository, environment):
"""List deploys"""
client = Deploy(config.client)
result = client.list(repository, environment)
header = ('ID', 'Repository ID', 'Environment ID', 'State', 'Version')
data = response('deploy', 'list', result)

tableprint.table(data, headers=header, width=int(config.width), style=config.style, out=output)
Expand All @@ -36,7 +36,6 @@ def deploy_get(config, id):
"""Get info from deploy"""
client = Deploy(config.client)
result = client.get(id)
header = ('ID', 'Repository ID', 'Environment ID', 'State', 'Version')
data = response('deploy', 'get', result)

tableprint.table(data, headers=header, width=int(config.width), style=config.style, out=output)
Expand All @@ -50,7 +49,6 @@ def deploy_get(config, id):
"""Trigger a specific deploy"""
client = Deploy(config.client)
result = client.get(id)
header = ('ID', 'Repository ID', 'Environment ID', 'State', 'Version')
data = response('deploy', 'trigger', result)

tableprint.table(data, headers=header, width=int(config.width), style=config.style, out=output)
Expand Down
3 changes: 1 addition & 2 deletions cli/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

output = StringIO()
pass_config = click.make_pass_decorator(Config, ensure=True)
header = ('ID', 'Repository ID', 'Environment Name', 'Branch', 'Automatic', 'Current')


@click.group('environment', short_help='Environment commands')
Expand All @@ -21,7 +22,6 @@ def environment_list(config, repository=None):
"""List environments"""
client = Environment(config.client)
result = client.list(repository)
header = ('ID', 'Repository ID', 'Environment Name', 'Branch', 'Automatic', 'Current')
data = response('environment', 'list', result)

tableprint.table(data, headers=header, width=int(config.width), style=config.style, out=output)
Expand All @@ -35,7 +35,6 @@ def environment_get(config, id):
"""Get info from environment"""
client = Environment(config.client)
result = client.get(id)
header = ('ID', 'Repository ID', 'Environment Name', 'Branch', 'Automatic', 'Current')
data = response('environment', 'get', result)

tableprint.table(data, headers=header, width=int(config.width), style=config.style, out=output)
Expand Down
3 changes: 1 addition & 2 deletions cli/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

output = StringIO()
pass_config = click.make_pass_decorator(Config, ensure=True)
header = ('ID', 'Title', 'Name')


@click.group('repository', short_help='Repository commands')
Expand All @@ -20,7 +21,6 @@ def repository_list(config):
"""List repositorys"""
client = Repository(config.client)
result = client.list()
header = ('ID', 'Title', 'Name')
data = response('repository', 'list', result)

tableprint.table(data, headers=header, width=int(config.width), style=config.style, out=output)
Expand All @@ -34,7 +34,6 @@ def repository_get(config, id):
"""Get info from repository"""
client = Repository(config.client)
result = client.get(id)
header = ('ID', 'Title', 'Name')
data = response('repository', 'get', result)

tableprint.table(data, headers=header, width=int(config.width), style=config.style, out=output)
Expand Down
3 changes: 1 addition & 2 deletions cli/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

output = StringIO()
pass_config = click.make_pass_decorator(Config, ensure=True)
header = ('ID', 'Environment ID', 'Name', 'Protocol')


@click.group('server', short_help='Server commands')
Expand All @@ -20,7 +21,6 @@ def server_list(config):
"""List servers"""
client = Server(config.client)
result = client.list()
header = ('ID', 'Environment ID', 'Name', 'Protocol')
data = response('server', 'list', result)

tableprint.table(data, headers=header, width=int(config.width), style=config.style, out=output)
Expand All @@ -34,7 +34,6 @@ def server_get(config, id):
"""Get info from server"""
client = Server(config.client)
result = client.get(id)
header = ('ID', 'Environment ID', 'Name', 'Protocol')
data = response('server', 'get', result)

tableprint.table(data, headers=header, width=int(config.width), style=config.style, out=output)
Expand Down
3 changes: 1 addition & 2 deletions cli/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

output = StringIO()
pass_config = click.make_pass_decorator(Config, ensure=True)
header = ('ID', 'Name', 'Email', 'Admin')


@click.group('user', short_help='User account commands')
Expand All @@ -20,7 +21,6 @@ def user_list(config):
"""List all users from account"""
client = User(config.client)
result = client.list()
header = ('ID', 'Name', 'Email', 'Admin')
data = response('user', 'list', result)

tableprint.table(data, headers=header, width=int(config.width), style=config.style, out=output)
Expand All @@ -34,7 +34,6 @@ def user_get(config, id):
"""Get info from user"""
client = User(config.client)
result = client.get(id)
header = ('ID', 'Name', 'Email', 'Admin')
data = response('user', 'get', result)

tableprint.table(data, headers=header, width=int(config.width), style=config.style, out=output)
Expand Down

0 comments on commit 9843379

Please sign in to comment.