Skip to content

Commit

Permalink
add version command
Browse files Browse the repository at this point in the history
  • Loading branch information
amalfra committed Dec 13, 2017
1 parent 1a323fd commit 4a73d62
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
7 changes: 7 additions & 0 deletions src/commands/version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# -*- encoding: utf-8 -*-
from .. import __version__


def run(docker_hub_client, args):
""" The command to list repos of given org from docker hub """
print 'docker-hub ' + __version__
2 changes: 1 addition & 1 deletion src/consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
'page': 'The page of result to fetch',
'status': 'To query for only builds with specified status'
}
VALID_METHODS = ['repos', 'tags', 'builds', 'users', 'queue']
VALID_METHODS = ['repos', 'tags', 'builds', 'users', 'queue', 'version']
VALID_DISPLAY_FORMATS = ['table', 'json']
DOCKER_AUTH_FILE = '~/.docker/config.json'
CONFIG_FILE = '~/.docker-hub/config.json'
Expand Down
7 changes: 4 additions & 3 deletions src/libs/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,10 @@ def __init__(self, option_strings, dest, nargs=None, **kwargs):
self.make_required = x

def __call__(self, parser, namespace, values, option_string=None):
options_required = self.make_required[values]
for x in options_required:
x.required = True
if values in self.make_required:
options_required = self.make_required[values]
for x in options_required:
x.required = True
try:
setattr(namespace, self.dest, values)
return super(CondAction, self).__call__(parser, namespace, values,
Expand Down

0 comments on commit 4a73d62

Please sign in to comment.