{"id":28352984,"url":"https://github.com/kh3rld/rfgrep","last_synced_at":"2025-10-12T21:06:12.132Z","repository":{"id":294856779,"uuid":"988268248","full_name":"kh3rld/rfgrep","owner":"kh3rld","description":" Powerful File Content Search and Listing Tool","archived":false,"fork":false,"pushed_at":"2025-06-18T09:01:55.000Z","size":64,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-18T10:19:33.755Z","etag":null,"topics":["cli","rust-lang"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/rfgrep","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kh3rld.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-22T09:51:08.000Z","updated_at":"2025-06-18T08:38:51.000Z","dependencies_parsed_at":null,"dependency_job_id":"e5103637-3593-44df-bf64-555567f4c2b4","html_url":"https://github.com/kh3rld/rfgrep","commit_stats":null,"previous_names":["kh3rld/rfgrep"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/kh3rld/rfgrep","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kh3rld%2Frfgrep","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kh3rld%2Frfgrep/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kh3rld%2Frfgrep/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kh3rld%2Frfgrep/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kh3rld","download_url":"https://codeload.github.com/kh3rld/rfgrep/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kh3rld%2Frfgrep/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260532163,"owners_count":23023448,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","rust-lang"],"created_at":"2025-05-28T00:10:06.986Z","updated_at":"2025-10-12T21:06:12.113Z","avatar_url":"https://github.com/kh3rld.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rfgrep  \n\nA command-line utility for recursively searching and listing files with advanced filtering capabilities. Built in Rust.\n\n[\u003cimg alt=\"crates.io\" src=\"https://img.shields.io/crates/v/rfgrep.svg?style=for-the-badge\u0026color=fc8d62\u0026logo=rust\" height=\"20\"\u003e](https://crates.io/crates/rfgrep)\n[\u003cimg alt=\"docs.rs\" src=\"https://img.shields.io/badge/docs.rs-rfgrep-66c2a5?style=for-the-badge\u0026labelColor=555555\u0026logo=docs.rs\" height=\"20\"\u003e](https://docs.rs/rfgrep)\n[![CI](https://github.com/kh3rld/rfgrep/actions/workflows/ci.yml/badge.svg)](https://github.com/kh3rld/rfgrep/actions/workflows/ci.yml)\n[![License](https://img.shields.io/github/license/kh3rld/rfgrep)](https://github.com/kh3rld/rfgrep/blob/main/LICENSE)\n\n[![DeepSource](https://app.deepsource.com/gh/kh3rld/rfgrep.svg/?label=active+issues\u0026show_trend=true)](https://app.deepsource.com/gh/kh3rld/rfgrep/)\n\n\n[![Get it from the Snap Store](https://snapcraft.io/en/dark/install.svg)](https://snapcraft.io/rfgrep)\n\n## Features\n\n- **Advanced Search**\n  - Regex, plain text, and whole-word matching\n  - Recursive directory traversal\n  - Binary file detection\n  - Extension filtering\n  - Size limits\n\n- **File Listing**\n  - Detailed/simple output formats\n  - Extension statistics\n  - Size filtering\n  - Hidden file handling\n\n- **Utilities**\n  - Clipboard copy support\n  - Dry-run mode\n  - Logging to file\n  - Progress indicators\n\n\u003c!-- ## Performance\n\n![Benchmark Results](https://github.com/kh3rld/rfgrep/raw/main/benches/comparison.png)\n\nLatest benchmarks (Linux x86_64):\n```bash\n# Updated automatically by CI\ncat benches/latest.txt --\u003e\n\n## Installation\n\nAssuming you have [Rust installed][Rust], run:\n\n[Rust]: https://www.rust-lang.org/\n\n### Via Cargo\n\n```bash\ncargo install rfgrep\n```\n\n### From GitHub\n```bash\ncargo install --git https://github.com/kh3rld/rfgrep.git\n```\n\n### From Source\n\n```bash\ngit clone https://github.com/kh3rld/rfgrep.git\ncargo build --release\n```\n\n### Installing Man Pages\n\nAfter installing rfgrep, you can install the comprehensive man pages:\n\n#### System-wide Installation (requires sudo)\n```bash\ncd man\nsudo make install\n```\n\n#### User Installation (no sudo required)\n```bash\ncd man\nmake install-user\n```\n\nThen add to your shell profile (`.bashrc`, `.zshrc`, etc.):\n```bash\nexport MANPATH=$MANPATH:$HOME/.local/share/man\n```\n\n### Installing Shell Completions\n\nrfgrep supports tab completion for all major shells:\n\n#### Bash\n```bash\n# Generate and source completion\nrfgrep completions bash \u003e\u003e ~/.bashrc\nsource ~/.bashrc\n```\n\n#### Zsh\n```bash\n# Generate completion file\nrfgrep completions zsh \u003e ~/.zsh/completions/_rfgrep\n# Add to .zshrc\necho 'fpath=(~/.zsh/completions $fpath)' \u003e\u003e ~/.zshrc\nautoload -U compinit \u0026\u0026 compinit\n```\n\n#### Fish\n```bash\n# Generate and install\nrfgrep completions fish --install --user\n```\n\n#### PowerShell\n```bash\n# Generate and import\nrfgrep completions powershell \u003e rfgrep-completion.ps1\n. rfgrep-completion.ps1\n```\n\n## Usage\n\n### Basic Search\n\n```bash\nrfgrep search \"pattern\"\n```\n\n### Search with Options\n\n```bash\nrfgrep search \"pattern\" \\\n    --mode regex \\\n    --extensions rs,toml \\\n    --max-size 5 \\\n    --skip-binary \\\n    --copy\n```\n\n### File Listing\n\n```bash\n# Simple list\nrfgrep list\n\n# Detailed view\nrfgrep list --long --recursive\n\n# With filters\nrfgrep list --extensions rs,toml --max-size 10 --show-hidden\n```\n\n## Documentation\n\nSee DESIGN_OPTIMIZATION.md for the latest simulation findings and the optimized framework proposal, including cross-disciplinary applications and roadmap.\n\n### Simulations\n\nQuickly run built-in simulations and write a CSV report to ./results/simulations.csv:\n\n```bash\nrfgrep simulate\n```\n\nYou can change the working directory with --path to select a corpus (defaults to . and prefers ./bench_data if present).\n\n### Man Pages\n\nAfter installation, comprehensive man pages are available:\n\n```bash\n# Main man page\nman rfgrep\n\n# Command-specific man pages\nman rfgrep-search\nman rfgrep-interactive\nman rfgrep-list\nman rfgrep-completions\n```\n\nThe man pages include:\n- Complete command reference\n- Detailed option descriptions\n- Practical examples\n- Performance tips\n- Troubleshooting guides\n\n### Shell Completions\n\nOnce installed, tab completion provides:\n- Command completion (`rfgrep \u003cTAB\u003e`)\n- Option completion (`rfgrep search --\u003cTAB\u003e`)\n- Extension completion (`--extensions \u003cTAB\u003e`)\n- File path completion (`src/\u003cTAB\u003e`)\n\n### Troubleshooting\n\n#### Man Pages Not Found\n```bash\n# Check if man pages are installed\nls ~/.local/share/man/man1/rfgrep*\n\n# Add to shell profile if needed\necho 'export MANPATH=$MANPATH:$HOME/.local/share/man' \u003e\u003e ~/.bashrc\n```\n\n#### Completions Not Working\n```bash\n# Regenerate completions\nrfgrep completions bash \u003e ~/.bash_completion.d/rfgrep\n\n# Reload shell configuration\nsource ~/.bashrc\n\n# For zsh, ensure completion directory exists\nmkdir -p ~/.zsh/completions\nrfgrep completions zsh \u003e ~/.zsh/completions/_rfgrep\n\n# For fish, install to user directory\nrfgrep completions fish --install --user\n```\n\n#### Performance Issues\n```bash\n# Use dry-run to preview\nrfgrep search \"pattern\" --dry-run\n\n# Skip binary files\nrfgrep search \"pattern\" --skip-binary\n\n# Limit file size\nrfgrep search \"pattern\" --max-size 10\n\n# Use specific extensions\nrfgrep search \"pattern\" --extensions rs,py,js\n```\n\n#### Shell-Specific Troubleshooting\n\n**Bash:**\n```bash\n# Check if completion is loaded\ncomplete -p | grep rfgrep\n\n# Manual installation\nrfgrep completions bash \u003e\u003e ~/.bashrc\nsource ~/.bashrc\n```\n\n**Zsh:**\n```bash\n# Check completion directory\nls ~/.zsh/completions/_rfgrep\n\n# Reload completions\nautoload -U compinit \u0026\u0026 compinit\n```\n\n**Fish:**\n```bash\n# Check if completion is installed\nls ~/.config/fish/completions/rfgrep.fish\n\n# Manual installation\nrfgrep completions fish \u003e ~/.config/fish/completions/rfgrep.fish\n```\n\n## Command Reference\n\n### Global Options\n\n| Option       | Description                     |\n|--------------|---------------------------------|\n| `--log PATH` | Write logs to specified file    |\n| `--path DIR` | Base directory (default: `.`)   |\n\n### Search Command\n\n| Option             | Description                         |\n|--------------------|-------------------------------------|\n| `--mode MODE`      | Search mode: regex/text/word        |\n| `--extensions EXT` | Comma-separated file extensions     |\n| `--max-size MB`    | Skip files larger than specified MB |\n| `--skip-binary`    | Skip binary files                   |\n| `--dry-run`        | Preview files without processing    |\n| `--copy`           | Copy results to clipboard           |\n| `--safety-policy`  | Safety policy: default/conservative/performance |\n| `--threads N`      | Number of threads for parallel processing |\n| `--file-types`     | File type strategy: default/comprehensive/conservative/performance |\n| `--include-extensions` | Override to include specific file types |\n| `--exclude-extensions` | Override to exclude specific file types |\n| `--search-all-files` | Search all file types (comprehensive mode) |\n| `--text-only`      | Only search text files (conservative mode) |\n\n### List Command\n\n| Option             | Description                         |\n|--------------------|-------------------------------------|\n| `--extensions EXT` | Comma-separated file extensions     |\n| `--long`           | Detailed output format              |\n| `--recursive`      | Recursive directory traversal       |\n| `--show-hidden`    | Include hidden files/directories    |\n| `--max-size MB`    | Skip files larger than specified MB |\n| `--skip-binary`    | Skip binary files                   |\n\n## Examples\n\n1. Find all Rust files containing \"HashMap\":\n\n```bash\nrfgrep search \"HashMap\" --extensions rs\n```\n\n1. List all Markdown files under 1MB:\n\n```bash\nrfgrep list --extensions md --max-size 1\n```\n\n1. Search with regex and copy to clipboard:\n\n```bash\nrfgrep search \"fn\\s+\\w+\\s*\\(\" --mode regex --copy\n\n# Advanced file type control\nrfgrep search \"pattern\" --file-types comprehensive --include-extensions pdf,docx\nrfgrep search \"pattern\" --text-only --safety-policy conservative\nrfgrep search \"pattern\" --threads 4 --safety-policy performance\n\n# Simulation and benchmarking\nrfgrep simulate\n```\n\n## Performance Tips\n\n- Use `--skip-binary` to avoid unnecessary file checks\n- Limit scope with `--extensions` and `--max-size`\n- For large directories, `--dry-run` first to preview\n- Use `--safety-policy performance` for faster processing\n- Adjust `--threads` based on your CPU cores\n- Use `--file-types conservative` for safe text-only search\n\n## Advanced Usage\n\n### Interactive Mode\n```bash\n# Start interactive search\nrfgrep interactive \"pattern\"\n\n# Interactive search with specific algorithm\nrfgrep interactive \"pattern\" --algorithm boyer-moore\n\n# Interactive search in specific file types\nrfgrep interactive \"pattern\" --extensions rs,py\n```\n\n### Output Formats\n```bash\n# JSON output for programmatic processing\nrfgrep search \"pattern\" --output-format json\n\n# XML output for structured data\nrfgrep search \"pattern\" --output-format xml\n\n# HTML output for web display\nrfgrep search \"pattern\" --output-format html\n\n# Markdown output for documentation\nrfgrep search \"pattern\" --output-format markdown\n```\n\n### Search Algorithms\n```bash\n# Boyer-Moore (fast for plain text)\nrfgrep search \"pattern\" --algorithm boyer-moore\n\n# Regular expression\nrfgrep search \"pattern\" --algorithm regex\n\n# Simple linear search\nrfgrep search \"pattern\" --algorithm simple\n```\n\n## Verification\n\n### Test Man Pages\n```bash\n# Verify man pages are accessible\nman rfgrep\nman rfgrep-search\nman rfgrep-interactive\nman rfgrep-list\nman rfgrep-completions\n```\n\n### Test Shell Completions\n```bash\n# Bash: Type 'rfgrep ' and press TAB\nrfgrep \u003cTAB\u003e\n\n# Zsh: Type 'rfgrep ' and press TAB\nrfgrep \u003cTAB\u003e\n\n# Fish: Type 'rfgrep ' and press TAB\nrfgrep \u003cTAB\u003e\n```\n\n### Test Basic Functionality\n```bash\n# Test search functionality\nrfgrep search \"test\" --extensions rs\n\n# Test list functionality\nrfgrep list --extensions rs\n\n# Test interactive mode\nrfgrep interactive \"test\" --extensions rs\n```\n\n### Clipboard behavior in CI/headless environments\n\nNote: the `--copy` option attempts to use the system clipboard and may fail in headless CI environments (X11/Wayland not available). In those environments run without `--copy` or provide a virtual display (Xvfb) or configure your CI to provide a clipboard service. The application will log a warning if the clipboard operation times out.\n\n### Automated Testing\n```bash\n# Test shell completions\n./test_completions.sh\n\n# Test man pages\n./test_man_pages.sh\n```\n\n## Contributing\n\nContributions are welcome! Please open an issue or PR for any:\n- Bug reports\n- Feature requests\n- Performance improvements\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkh3rld%2Frfgrep","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkh3rld%2Frfgrep","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkh3rld%2Frfgrep/lists"}