-
Notifications
You must be signed in to change notification settings - Fork 0
Feat/inbuilt docs: added new flag to show comprehensive docs in local browser #18
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
Conversation
Signed-off-by: rohansen856 <rohansen856@gmail.com>
Signed-off-by: rohansen856 <rohansen856@gmail.com>
Signed-off-by: rohansen856 <rohansen856@gmail.com>
Signed-off-by: rohansen856 <rohansen856@gmail.com>
Signed-off-by: rohansen856 <rohansen856@gmail.com>
There was a problem hiding this 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 pull request introduces a comprehensive documentation system for the Git Editor tool. The main feature is a new --docs command-line flag that generates and opens detailed technical documentation in the user's browser, along with automated GitHub Pages deployment for online access.
Key changes include:
- Added
--docsflag for local documentation generation and browser opening - Implemented comprehensive HTML documentation with interactive features
- Set up GitHub Actions workflow for automated documentation deployment
Reviewed Changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/args.rs | Added docs field to Args struct and updated validation logic |
| src/main.rs | Added docs operation mode and execution handling |
| src/docs.rs | New module for documentation generation and browser opening |
| src/utils/validator.rs | Updated validation to skip all checks in docs mode |
| docs/template.html | Comprehensive HTML documentation template |
| tests/integration_tests.rs | Added extensive tests for docs mode functionality |
| .github/workflows/github-pages.yml | GitHub Actions workflow for automated docs deployment |
| Cargo.toml | Added open crate dependency for browser launching |
| README.md | Updated with documentation links and usage information |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
|
||
| // Skip validation for email, name, start, end if using show_history, pick_specific_commits, range, or simulate | ||
| if args.show_history || args.pick_specific_commits || args.range || args.simulate { | ||
| // Skip validation for email, name, start, end if using show_history, pick_specific_commits, range, simulate, or docs |
Copilot
AI
Sep 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment on line 33 is outdated and inconsistent with the early return for docs mode on lines 7-10. Since docs mode now has its own early return that skips ALL validation, this comment should be updated to reflect that docs mode is handled separately above.
| // Skip validation for email, name, start, end if using show_history, pick_specific_commits, range, simulate, or docs | |
| // Skip validation for email, name, start, end if using show_history, pick_specific_commits, range, or simulate |
| // Build the absolute path to the binary | ||
| let project_root = std::env::current_dir().expect("Failed to get current dir"); | ||
| let binary_path = project_root.join("target/debug/git-editor"); | ||
|
|
||
| let output = std::process::Command::new(binary_path) | ||
| .args(["--docs"]) |
Copilot
AI
Sep 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The hardcoded path 'target/debug/git-editor' assumes a debug build exists, but the test doesn't ensure the binary is built first. This could lead to test failures if the binary hasn't been compiled. Consider using cargo run instead like other tests, or add a step to ensure the binary exists.
| // Build the absolute path to the binary | |
| let project_root = std::env::current_dir().expect("Failed to get current dir"); | |
| let binary_path = project_root.join("target/debug/git-editor"); | |
| let output = std::process::Command::new(binary_path) | |
| .args(["--docs"]) | |
| // Use cargo run to ensure the binary is built and executed | |
| let output = std::process::Command::new("cargo") | |
| .args(["run", "--", "--docs"]) |
| fn open_in_browser(file_path: &std::path::Path) -> Result<()> { | ||
| // Skip browser opening if NO_BROWSER environment variable is set or if running in test context | ||
| if std::env::var("NO_BROWSER").is_ok() | ||
| || std::env::var("GIT_EDITOR_NO_BROWSER").is_ok() |
Copilot
AI
Sep 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The function checks for both NO_BROWSER and GIT_EDITOR_NO_BROWSER environment variables, but this duplication could lead to confusion. Consider standardizing on one variable name or documenting why both are needed.
| || std::env::var("GIT_EDITOR_NO_BROWSER").is_ok() |
| # Copy the generated HTML to docs-site directory | ||
| cp /tmp/git-editor-docs.html docs-site/index.html |
Copilot
AI
Sep 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The hardcoded path /tmp/git-editor-docs.html creates a tight coupling between the documentation generation logic and the GitHub Actions workflow. If the temp file location changes in the future, this workflow will break. Consider making the temp file location configurable or using a more predictable location.
This pull request introduces a new "documentation mode" to the project, allowing users to quickly access comprehensive technical documentation both online and directly from the command line. It adds a new
--docsCLI flag, integrates documentation generation and browser opening into the main workflow, and sets up automated deployment of documentation to GitHub Pages. Several tests and supporting code changes are included to ensure robust handling of this new feature.Documentation Access & Generation
--docscommand-line flag toArgsinsrc/args.rs, enabling users to open comprehensive documentation in their browser.execute_docs_operationfunction in the newsrc/docs.rsmodule, which generates the documentation HTML and opens it in the default browser, handling edge cases and environment variables.src/main.rsto support the new documentation mode, including operation mode detection and invocation of the docs operation. [1] [2] [3]Continuous Deployment & Online Documentation
.github/workflows/github-pages.ymlto build, generate, and deploy documentation to GitHub Pages automatically on pushes and workflow dispatches.README.mdto advertise the new online documentation and the--docsflag for quick access, including a detailed list of documentation features.Testing & Validation
src/args.rsand other modules to cover the newdocsflag, ensuring correct behavior and validation skipping in documentation mode. [1] [2]Argsacross the codebase include the newdocsfield for consistency. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15]Dependencies
opencrate toCargo.tomlto support opening files in the default browser.