Skip to content

Commit 7419a54

Browse files
committed
Add a --oneline option to config:list
1 parent 6572323 commit 7419a54

1 file changed

Lines changed: 15 additions & 5 deletions

File tree

client/deis.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -790,11 +790,13 @@ def config_list(self, args):
790790
"""
791791
List environment variables for an application
792792
793-
Usage: deis config:list [--app=<app>]
793+
Usage: deis config:list [--oneline] [--app=<app>]
794794
"""
795795
app = args.get('--app')
796796
if not app:
797797
app = self._session.app
798+
799+
oneline = args.get('--oneline')
798800
response = self._dispatch('get', "/api/apps/{}/config".format(app))
799801
if response.status_code == requests.codes.ok: # @UndefinedVariable
800802
config = response.json()
@@ -805,10 +807,18 @@ def config_list(self, args):
805807
print('No configuration')
806808
return
807809
keys = sorted(values)
808-
width = max(map(len, keys)) + 5
809-
for k in keys:
810-
v = values[k]
811-
print(("{k:<"+str(width)+"} {v}").format(**locals()))
810+
811+
if not oneline:
812+
width = max(map(len, keys)) + 5
813+
for k in keys:
814+
v = values[k]
815+
print(("{k:<"+str(width)+"} {v}").format(**locals()))
816+
else:
817+
output = []
818+
for k in keys:
819+
v = values[k]
820+
output.append("{k}={v}".format(**locals()))
821+
print(' '.join(output))
812822
else:
813823
raise ResponseError(response)
814824

0 commit comments

Comments
 (0)