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

feat: refactor --tldr flag #47

Merged
merged 15 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
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
87 changes: 44 additions & 43 deletions execexam/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,50 +35,51 @@ def display_tldr(console: Console) -> None:
console.print(
"[bold yellow]Too Lazy; Didn't Read: Example Commands[/bold yellow]\n"
)
console.print(
"[bold red]Please ensure you are in the directory with the pyproject.toml file to run these commands.[/bold red]\n"
)

console.print(
"[bold cyan]poetry run execexam <path-to-project> <path-to-tests>[/bold cyan]"
)
console.print(
" Run executable exam for a project with the specified test files."
)

console.print(
"[bold cyan]poetry run execexam <path-to-project> <path-to-tests> --mark <mark>[/bold cyan]"
)
console.print(" Run the tests with the specified mark(s).")

console.print(
"[bold cyan]poetry run execexam <path-to-project> <path-to-tests> --maxfail[/bold cyan]"
)
console.print(" Limit the number of test failures before stopping.")

console.print(
"[bold cyan]poetry run execexam <path-to-project> <path-to-tests> --report <report_type>/<all>[/bold cyan]"
)
console.print(
" Generate the specified type(s) of reports after the exam. Use 'all' to generate all available report types."
)

console.print(
"[bold cyan]poetry run execexam <path-to-project> <path-to-tests> --advice-model <model> --advice-method <method>[/bold cyan]"
)
console.print(
" Use specified LLM model and method for providing advice on test failures."
)

console.print(
"[bold cyan]poetry run execexam <path-to-project> <path-to-tests> <--debug>/<--no-debug>[/bold cyan]"
)
console.print(" Display or disable debugging information.")

console.print(
"[bold cyan]poetry run execexam <path-to-project> <path-to-tests> <--fancy>/<--no-fancy>[/bold cyan]"
)
console.print(" Display or disable fancy output formatting.")
commands = {
"mark": {
"command": "run execexam <path-to-project> <path-to-tests> --mark mark_type",
"description": "Run tests with specific markers (e.g., unit, integration, functional)",
},
"maxfail": {
"command": "run execexam <path-to-project> <path-to-tests> --maxfail number",
"description": "Set maximum number of test failures before stopping test execution (default: 10)",
},
"report": {
"command": "run execexam <path-to-project> <path-to-tests> --report report_type/all",
"description": "Generate the specified type(s) of reports after the exam. Use 'all' to generate all available report types.",
},
"advice-method": {
"command": " --advice-method <method> --advice-model <model> --advice-server <server>",
"description": "Specify the LLM model and advice method to use Coding Mentor. Consult documentation for available models and methods.",
},
"debug": {
"command": "run execexam <path-to-project> <path-to-tests> --debug/--no-debug",
"description": "Enable or disable debug mode to collect additional debugging information during execution.",
},
"fancy": {
"command": "run execexam <path-to-project> <path-to-tests> --fancy/--no-fancy",
"description": "Toggle fancy output formatting. Disable for simpler output in plain-text environments.",
},
"verbose": {
"command": "run execexam <path-to-project> <path-to-tests> --verbose/--no-verbose",
"description": "Enable or disable verbose output to see more detailed logs of the program's execution.",
},
"syntax-theme": {
"command": "run execexam <path-to-project> <path-to-tests> --syntax-theme theme_name",
"description": "Choose syntax highlighting theme for code output (options: ansi_dark, ansi_light)",
},
}

for command_name, command_info in commands.items():
console.print(f"[bold green]{command_name}[/bold green]")
console.print(
f"[bold white]Command:[/bold white] [bold cyan]{command_info['command']}[/bold cyan]"
)
console.print(
f"[bold white]Description:[/bold white] {command_info['description']}"
)
console.print()

console.print(
"\n[bold yellow]help:[/bold yellow] Use [bold yellow]--help[/bold yellow] to see more options."
Expand Down
7 changes: 4 additions & 3 deletions execexam/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def run( # noqa: PLR0913, PLR0915
callback=tldr_callback,
help="Display summary of commands",
),
] = None,
] = False,
report: Optional[List[enumerations.ReportType]] = typer.Option(
None,
help="Types of reports to generate",
Expand Down Expand Up @@ -103,8 +103,9 @@ def run( # noqa: PLR0913, PLR0915
litellm_thread = threading.Thread(target=advise.load_litellm)
# if --tldr was specified, then display the TLDR summary
# of the commands and then exit the program
if tldr is not None:
return
if tldr:
display.display_tldr(console)
raise typer.Exit()
# if execexam was configured to produce the report for advice
# or if it was configured to produce all of the possible reports,
# then start the litellm thread that provides the advice
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "execexam"
version = "0.3.0"
description = "ExecExam runs executable examinations, providing feedback and assistance!"
authors = ["Gregory M. Kapfhammer <[email protected]>"]
authors = ["Hemani Alaparthi <[email protected]>","Gregory M. Kapfhammer <[email protected]>"]
readme = "README.md"

[tool.poetry.scripts]
Expand Down
Loading