Skip to content

Commit 35475f9

Browse files
committed
make autocomplete optional in the login shell eval
1 parent 483504e commit 35475f9

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

netfoundry/ctl.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ def main(cli):
101101
login(cli)
102102

103103

104+
@cli.argument('-a', '--autocomplete', action='store_boolean', default=True, help="include tab autocomplete configuration in shell eval")
104105
@cli.argument('-e', '--eval', help="source or eval output to configure shell environment with a login token", arg_only=True, action="store_true", default=False)
105106
@cli.subcommand('login to NetFoundry with a user token or API account credentials')
106107
def login(cli):
@@ -191,6 +192,7 @@ def login(cli):
191192
AWS_REGION AWS_DEFAULT_REGION AWS_SHARED_CREDENTIALS_FILE
192193
}
193194
"""
195+
autocomplete = f'eval "$(register-python-argcomplete {cli.prog_name})"'
194196
token_env = f"""
195197
# $ eval "$({cli.prog_name} --credentials={organization.credentials} login --eval)"
196198
export NETFOUNDRY_API_TOKEN="{organization.token}"
@@ -200,9 +202,9 @@ def login(cli):
200202
{'export NETFOUNDRY_NETWORK_GROUP="'+network_group.id+'"' if network_group else '# NETFOUNDRY_NETWORK_GROUP'}
201203
export MOPENV="{organization.environment}"
202204
export MOPURL="{organization.audience}"
203-
eval "$(register-python-argcomplete {cli.prog_name})"
205+
{autocomplete if cli.config.login.autocomplete else '# autocomplete skipped'}
204206
{nonf}
205-
{noaws}
207+
{noaws if cli.prog_name == 'nfsupport' else ''}
206208
"""
207209
if cli.config.general.color:
208210
highlighted = highlight(token_env, bash_lexer, Terminal256Formatter(style=cli.config.general.style))

0 commit comments

Comments
 (0)