Skip to content

Commit a13d0f4

Browse files
committed
CM-22206 Move output option to parent command due to future reworking
1 parent 1b4b86f commit a13d0f4

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

cli/auth/auth_command.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,17 @@
1313

1414

1515
@click.group(invoke_without_command=True)
16+
@click.option(
17+
'--output',
18+
default='text',
19+
help='Specify the output (text/json), the default is text',
20+
type=click.Choice(['text', 'json'])
21+
)
1622
@click.pass_context
17-
def authenticate(context: click.Context):
23+
def authenticate(context: click.Context, output: str):
1824
""" Authenticates your machine to associate CLI with your cycode account """
1925
if context.invoked_subcommand is not None:
20-
# if it is a subcommand do nothing
26+
context.obj['output'] = output
2127
return
2228

2329
try:
@@ -30,18 +36,12 @@ def authenticate(context: click.Context):
3036

3137

3238
@authenticate.command(name='check')
33-
@click.option(
34-
'--output',
35-
default='text',
36-
help='Specify the output (text/json), the default is text',
37-
type=click.Choice(['text', 'json'])
38-
)
3939
@click.pass_context
40-
def authorization_check(context: click.Context, output: str):
40+
def authorization_check(context: click.Context):
4141
""" Check your machine associating CLI with your cycode account """
4242
def print_result(*, result: bool) -> None:
4343
# the current impl of printers supports only results of scans
44-
if output == 'text':
44+
if context.obj['output'] == 'text':
4545
secho_args = {
4646
True: {'message': 'You are authorized', 'fg': 'green'},
4747
False: {'message': 'You are not authorized', 'fg': 'red'}

0 commit comments

Comments
 (0)