Skip to content

Commit c6539ed

Browse files
committed
improve docstrings and help for cli
1 parent fe18a9c commit c6539ed

File tree

1 file changed

+28
-5
lines changed

1 file changed

+28
-5
lines changed

src/humanloop/cli/__main__.py

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,17 +97,16 @@ def wrapper(*args, **kwargs):
9797
"max_content_width": 100,
9898
}
9999
)
100-
@common_options
101-
def cli(api_key: Optional[str], env_file: Optional[str], base_dir: str, base_url: Optional[str]):
100+
def cli():
102101
"""Humanloop CLI for managing sync operations."""
103102
pass
104103

105104
@cli.command()
106105
@click.option(
107106
"--path",
108107
"-p",
109-
help="Path to pull (file or directory). If not provided, pulls everything. "+
110-
"To pull a specific file, ensure the extension for the file is included (e.g. .prompt or .agent). "+
108+
help="Path to pull (file or directory). If not provided, pulls everything. "
109+
"To pull a specific file, ensure the extension for the file is included (e.g. .prompt or .agent). "
111110
"To pull a directory, simply specify the path to the directory (e.g. abc/def to pull all files under abc/def and its subdirectories).",
112111
default=None,
113112
)
@@ -118,8 +117,31 @@ def cli(api_key: Optional[str], env_file: Optional[str], base_dir: str, base_url
118117
default=None,
119118
)
120119
@handle_sync_errors
120+
@common_options
121121
def pull(path: Optional[str], environment: Optional[str], api_key: Optional[str], env_file: Optional[str], base_dir: str, base_url: Optional[str]):
122-
"""Pull files from Humanloop to your local filesystem."""
122+
"""Pull prompt and agent files from Humanloop to your local filesystem.
123+
124+
\b
125+
This command will:
126+
1. Fetch prompt and agent files from your Humanloop workspace
127+
2. Save them to your local filesystem
128+
3. Maintain the same directory structure as in Humanloop
129+
4. Add appropriate file extensions (.prompt or .agent)
130+
131+
\b
132+
The files will be saved with the following structure:
133+
{base_dir}/
134+
├── prompts/
135+
│ ├── my_prompt.prompt
136+
│ └── nested/
137+
│ └── another_prompt.prompt
138+
└── agents/
139+
└── my_agent.agent
140+
141+
The operation will overwrite existing files with the latest version from Humanloop
142+
but will not delete local files that don't exist in the remote workspace.
143+
144+
Currently only supports syncing prompt and agent files. Other file types will be skipped."""
123145
client = get_client(api_key, env_file, base_url)
124146
sync_client = SyncClient(client, base_dir=base_dir)
125147

@@ -164,6 +186,7 @@ def format_timestamp(timestamp: str) -> str:
164186
help="Display history in a single line per operation",
165187
)
166188
@handle_sync_errors
189+
@common_options
167190
def history(api_key: Optional[str], env_file: Optional[str], base_dir: str, base_url: Optional[str], oneline: bool):
168191
"""Show sync operation history."""
169192
client = get_client(api_key, env_file, base_url)

0 commit comments

Comments
 (0)