Skip to content

Commit ca45ee9

Browse files
authored
add hidden yes_option to profile create cmd (#219)
1 parent 7b91032 commit ca45ee9

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

src/code42cli/cmds/profile.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ def show(profile_name):
7070
@server_option
7171
@username_option
7272
@password_option
73+
@yes_option(hidden=True)
7374
@disable_ssl_option
7475
def create(name, server, username, password, disable_ssl_errors):
7576
"""Create profile settings. The first profile created will be the default."""
@@ -128,7 +129,7 @@ def use(profile_name):
128129

129130

130131
@profile.command()
131-
@yes_option
132+
@yes_option()
132133
@profile_name_arg(required=True)
133134
def delete(profile_name):
134135
"""Deletes a profile and its stored password (if any)."""
@@ -143,7 +144,7 @@ def delete(profile_name):
143144

144145

145146
@profile.command()
146-
@yes_option
147+
@yes_option()
147148
def delete_all():
148149
"""Deletes all profiles and saved passwords (if any)."""
149150
existing_profiles = cliprofile.get_all_profiles()

src/code42cli/options.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,17 @@
1414
from code42cli.sdk_client import create_sdk
1515

1616

17-
yes_option = click.option(
18-
"-y",
19-
"--assume-yes",
20-
is_flag=True,
21-
expose_value=False,
22-
callback=lambda ctx, param, value: ctx.obj.set_assume_yes(value),
23-
help='Assume "yes" as the answer to all prompts and run non-interactively.',
24-
)
17+
def yes_option(hidden=False):
18+
return click.option(
19+
"-y",
20+
"--assume-yes",
21+
is_flag=True,
22+
expose_value=False,
23+
callback=lambda ctx, param, value: ctx.obj.set_assume_yes(value),
24+
help='Assume "yes" as the answer to all prompts and run non-interactively.',
25+
hidden=hidden,
26+
)
27+
2528

2629
format_option = click.option(
2730
"-f",

0 commit comments

Comments
 (0)