Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add command descriptions #8

Merged
merged 2 commits into from
May 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/chap/commands/ask.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ async def work():
def main(
continue_session, last, new_session, system_message, prompt, backend
): # pylint: disable=too-many-arguments
"""Ask a question (command-line argument is passed as prompt)"""
if bool(continue_session) + bool(last) + bool(new_session) > 1:
raise SystemExit(
"--continue-session, --last and --new_session are mutually exclusive"
Expand Down
1 change: 1 addition & 0 deletions src/chap/commands/cat.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
@click.option("--session", "-s", type=click.Path(exists=True), default=None)
@click.option("--last", is_flag=True)
def main(session, last):
"""Print session in plaintext"""
if bool(session) + bool(last) != 1:
raise SystemExit("Specify either --session, or --last")

Expand Down
1 change: 1 addition & 0 deletions src/chap/commands/grep.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def list_files_matching_rx(
@click.option("--fixed-strings", "--literal", "-F", is_flag=True)
@click.argument("pattern", nargs=1, required=True)
def main(ignore_case, fixed_strings, pattern):
"""Search sessions for pattern"""
console = rich.get_console()
if fixed_strings:
pattern = re.escape(pattern)
Expand Down
1 change: 1 addition & 0 deletions src/chap/commands/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def to_markdown(message):
@click.option("--session", "-s", type=click.Path(exists=True), default=None)
@click.option("--last", is_flag=True)
def main(session, last):
"""Print session with formatting"""
if bool(session) + bool(last) != 1:
raise SystemExit("Specify either --session, or --last")

Expand Down
1 change: 1 addition & 0 deletions src/chap/commands/tui.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ def action_yank(self):
@click.option("--system-message", "-S", type=str, default=None)
@click.option("--backend", "-b", type=str, default="openai_chatgpt")
def main(continue_session, last, new_session, system_message, backend):
"""Start interactive terminal user interface session"""
if bool(continue_session) + bool(last) + bool(new_session) > 1:
raise SystemExit(
"--continue-session, --last and --new_session are mutually exclusive"
Expand Down