def cli(context): if auth.get_key_netrc(): click.echo("You're already logged in. To change credentials, use 'shub logout' first.") return 0 cfg_key = _find_cfg_key() key = _get_apikey(suggestion=cfg_key) auth.write_key_netrc(key)
def cli(context): if auth.get_key_netrc(): log("You're already logged in. To change credentials, use 'shub logout' first.") return 0 cfg_key = _find_cfg_key() key = _prompt_for_key(suggestion=cfg_key) if not key and is_valid_key(cfg_key): auth.write_key_netrc(cfg_key) elif key and is_valid_key(key): auth.write_key_netrc(key) else: context.fail('Invalid key. Tip: your key must have 32 characters.') log('Success.')