From dff53a9caebd01acdb8c79f6f52e0b5f8b038475 Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Mon, 11 Nov 2024 09:53:24 -0800 Subject: [PATCH] Better --help for llm keys get, refs #623 --- docs/help.md | 4 ++++ llm/cli.py | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/docs/help.md b/docs/help.md index 6d9ac6d..e5ad931 100644 --- a/docs/help.md +++ b/docs/help.md @@ -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. ``` diff --git a/llm/cli.py b/llm/cli.py index c864e23..69cd44e 100644 --- a/llm/cli.py +++ b/llm/cli.py @@ -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")