Better --help for llm keys get, refs #623

This commit is contained in:
Simon Willison 2024-11-11 09:53:24 -08:00
parent 561784df6e
commit dff53a9cae
2 changed files with 12 additions and 1 deletions

View file

@ -190,6 +190,10 @@ Usage: llm keys get [OPTIONS] NAME
Return the value of a stored key
Example usage:
export OPENAI_API_KEY=$(llm keys get openai)
Options:
--help Show this message and exit.
```

View file

@ -607,7 +607,14 @@ def keys_path_command():
@keys.command(name="get")
@click.argument("name")
def keys_get(name):
"Return the value of a stored key"
"""
Return the value of a stored key
Example usage:
\b
export OPENAI_API_KEY=$(llm keys get openai)
"""
path = user_dir() / "keys.json"
if not path.exists():
raise click.ClickException("No keys found")