Skip to content

Commit

Permalink
fix: update kay flow to match docs (#436)
Browse files Browse the repository at this point in the history
  • Loading branch information
chamini2 authored Mar 1, 2025
1 parent f68a791 commit e1bce25
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions projects/fal/src/fal/cli/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ def _set(args):
config.set_internal("profile", args.PROFILE)
args.console.print(f"Default profile set to [cyan]{args.PROFILE}[/].")
config.profile = args.PROFILE
if not config.get("key"):
args.console.print(
"No key set for profile. Use [bold]fal profile key[/] to set a key."
)
config.save()


Expand All @@ -39,8 +43,16 @@ def _unset(args):

def _key_set(args):
config = Config()
key_id, key_secret = args.KEY.split(":", 1)
config.set("key", f"{key_id}:{key_secret}")

while True:
key = input("Enter the key: ")
if ":" in key:
break
args.console.print(
"[red]Invalid key. The key must be in the format [bold]key:value[/].[/]"
)

config.set("key", key)
args.console.print(f"Key set for profile [cyan]{config.profile}[/].")
config.save()

Expand Down Expand Up @@ -109,10 +121,6 @@ def add_parser(main_subparsers, parents):
help=key_set_help,
parents=parents,
)
key_set_parser.add_argument(
"KEY",
help="Key ID and secret separated by a colon.",
)
key_set_parser.set_defaults(func=_key_set)

delete_help = "Delete profile."
Expand Down

0 comments on commit e1bce25

Please sign in to comment.