Skip to content

Commit 2a49b20

Browse files
docs
1 parent 8af650a commit 2a49b20

File tree

1 file changed

+16
-30
lines changed

1 file changed

+16
-30
lines changed

src/gitingest/cli.py

Lines changed: 16 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,6 @@ class _CLIArgs(TypedDict):
2626

2727
@click.command()
2828
@click.argument("source", type=str, default=".")
29-
@click.option(
30-
"--output",
31-
"-o",
32-
default=None,
33-
help="Output file path (default: digest.txt in current directory). Use '-' for stdout.",
34-
)
3529
@click.option(
3630
"--max-size",
3731
"-s",
@@ -63,32 +57,23 @@ class _CLIArgs(TypedDict):
6357
"If omitted, the CLI will look for the GITHUB_TOKEN environment variable."
6458
),
6559
)
60+
@click.option(
61+
"--output",
62+
"-o",
63+
default=None,
64+
help="Output file path (default: digest.txt in current directory). Use '-' for stdout.",
65+
)
6666
def main(**cli_kwargs: Unpack[_CLIArgs]) -> None:
67-
"""
68-
Main entry point for the CLI. This function is called when the CLI is run as a script.
69-
70-
It calls the async main function to run the command.
67+
"""Run the CLI entry point to analyze a repo / directory and dump its contents.
7168
7269
Parameters
7370
----------
74-
source : str
75-
A directory path or a Git repository URL.
76-
output : str, optional
77-
The path where the output file will be written. If not specified, the output will be written
78-
to a file named `digest.txt` in the current directory. Use '-' to output to stdout.
79-
max_size : int
80-
Maximum file size (in bytes) to consider.
81-
exclude_pattern : Tuple[str, ...]
82-
Glob patterns for pruning the file set.
83-
include_pattern : Tuple[str, ...]
84-
Glob patterns for including files in the output.
85-
branch : str, optional
86-
Specific branch to ingest (defaults to the repository's default).
87-
include_gitignored : bool
88-
If provided, include files normally ignored by .gitignore.
89-
token: str, optional
90-
GitHub personal-access token (PAT). Needed when *source* refers to a
91-
**private** repository. Can also be set via the ``GITHUB_TOKEN`` env var.
71+
**cli_kwargs : Unpack[_CLIArgs]
72+
A dictionary of keyword arguments forwarded to ``ingest_async``.
73+
74+
Notes
75+
-----
76+
See ``ingest_async`` for a detailed description of each argument.
9277
9378
Examples
9479
--------
@@ -108,6 +93,7 @@ def main(**cli_kwargs: Unpack[_CLIArgs]) -> None:
10893
Private repositories:
10994
$ gitingest https://github.com/user/private-repo -t ghp_token
11095
$ GITHUB_TOKEN=ghp_token gitingest https://github.com/user/private-repo
96+
11197
"""
11298
asyncio.run(_async_main(**cli_kwargs))
11399

@@ -147,8 +133,8 @@ async def _async_main(
147133
GitHub personal access token (PAT) for accessing private repositories.
148134
Can also be set via the ``GITHUB_TOKEN`` environment variable.
149135
output : str | None
150-
The path where the output file will be written. If not specified, the output will be written
151-
to a file named `digest.txt` in the current directory. Use '-' to output to stdout.
136+
The path where the output file will be written (default: ``digest.txt`` in current directory).
137+
Use ``"-"`` to write to ``stdout``.
152138
153139
Raises
154140
------

0 commit comments

Comments
 (0)