Skip to content

Conversation

Manjunath3155
Copy link
Contributor

@Manjunath3155 Manjunath3155 commented Oct 1, 2025

What type of PR is this? (check all applicable)

  • ♻️ Refactor
  • ✨ New Chapter
  • 🐛 Bug Fix/Typo
  • 👷 Optimization
  • 📝 Documentation Update
  • 🚩 Other

Description

  • add a global --verbose flag on the root Typer app so every command can emit consistent debug output
  • introduce a list subcommand that surfaces available lessons, supports --limit, and participates in verbose mode
  • extend CLI tests to cover both hello/list verbose flows and refresh the CLI README with new usage examples

Related Tickets & Documents

Added to documentation?

  • 📜 readme
  • 🙅 no documentation needed

@bobbyiliev bobbyiliev requested a review from Copilot October 1, 2025 14:15
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements a global --verbose flag for the CLI application to enable consistent debug output across all commands. The implementation introduces centralized state management for the verbose flag and adds a new list command for browsing available Linux command lessons.

Key changes:

  • Added global verbose flag support with cascade to subcommands
  • Introduced a new list command with limit functionality and verbose output
  • Extended test coverage for both verbose modes and new list command functionality

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
cli/cli.py Added global verbose flag callback and registered new list command
cli/state.py New module for managing verbose state across CLI contexts
cli/commands/hello.py Updated to support verbose output and use centralized state management
cli/commands/listing.py New list command with lesson discovery and verbose debug output
cli/test_cli.py Enhanced test suite with helper function and verbose/list command coverage
cli/README.md Updated documentation with new command examples and verbose flag usage

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +23 to +31
def _format_title(path: Path) -> str:
stem = path.stem
prefix, _, slug = stem.partition("-")
title = slug.replace("-", " ").strip().title() if slug else prefix.replace("-", " ")
if prefix.isdigit():
return f"{prefix} {title}".strip()
return title


Copy link
Preview

Copilot AI Oct 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The title formatting logic is complex and handles multiple cases in a single function. Consider splitting this into separate functions for prefix extraction and title formatting to improve readability and maintainability.

Suggested change
def _format_title(path: Path) -> str:
stem = path.stem
prefix, _, slug = stem.partition("-")
title = slug.replace("-", " ").strip().title() if slug else prefix.replace("-", " ")
if prefix.isdigit():
return f"{prefix} {title}".strip()
return title
def _extract_prefix_and_slug(stem: str) -> tuple[str, str]:
prefix, _, slug = stem.partition("-")
return prefix, slug
def _format_title_from_parts(prefix: str, slug: str) -> str:
title = slug.replace("-", " ").strip().title() if slug else prefix.replace("-", " ")
if prefix.isdigit():
return f"{prefix} {title}".strip()
return title
def _format_title(path: Path) -> str:
stem = path.stem
prefix, slug = _extract_prefix_and_slug(stem)
return _format_title_from_parts(prefix, slug)

Copilot uses AI. Check for mistakes.

Comment on lines +23 to +26
def _format_title(path: Path) -> str:
stem = path.stem
prefix, _, slug = stem.partition("-")
title = slug.replace("-", " ").strip().title() if slug else prefix.replace("-", " ")
Copy link
Preview

Copilot AI Oct 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line contains duplicated logic for replacing dashes with spaces. Extract this transformation into a variable or helper function to avoid repetition.

Suggested change
def _format_title(path: Path) -> str:
stem = path.stem
prefix, _, slug = stem.partition("-")
title = slug.replace("-", " ").strip().title() if slug else prefix.replace("-", " ")
def _dashes_to_spaces(s: str) -> str:
return s.replace("-", " ")
def _format_title(path: Path) -> str:
stem = path.stem
prefix, _, slug = stem.partition("-")
title = _dashes_to_spaces(slug).strip().title() if slug else _dashes_to_spaces(prefix)

Copilot uses AI. Check for mistakes.

Copy link
Owner

@bobbyiliev bobbyiliev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Manjunath3155 this looks perfect! Thank you for working on it. Just the CI is failing could you take a look at that? And also maybe look into some of the suggestions from the Copilot bot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants