### CLI: Version, Help, and Info Source: https://github.com/bitranox/igittigitt/blob/master/notebooks/Quickstart.ipynb Examples of using the igittigitt command-line interface to check the version, get help, and display info. ```bash !igittigitt --version ``` ```bash !igittigitt --help ``` ```bash !igittigitt info ``` -------------------------------- ### Install pipx and igittigitt Source: https://github.com/bitranox/igittigitt/blob/master/INSTALL.md Installs `pipx` and then uses it to install `igittigitt` from PyPI, GitHub, local source, or a specific Git tag. ```bash # install pipx via pip python -m pip install pipx # optional install pipx via apt sudo apt install python-pipx # install via pipx from PyPI pipx install igittigitt # optional install via pipx from GitHub pipx install "git+https://github.com/bitranox/igittigitt" # optional install from local pipx install . pipx upgrade igittigitt # install from Git tag pipx install "git+https://github.com/bitranox/igittigitt@v1.1.0" ``` -------------------------------- ### Install igittigitt using uv Source: https://github.com/bitranox/igittigitt/blob/master/README.md Install igittigitt as a project dependency, a standalone CLI tool, or run it once without installation using uv. Also shows classic pip and pipx installation. ```bash # as a project dependency uv add igittigitt ``` ```bash # as a standalone CLI tool (isolated environment, added to PATH) uv tool install igittigitt ``` ```bash # run once without installing uvx igittigitt --help ``` ```bash # or classic pip / pipx pip install igittigitt pipx install igittigitt ``` -------------------------------- ### Generate Example Configuration Files Source: https://github.com/bitranox/igittigitt/blob/master/CONFIG.md Use this command to generate example configuration files that can be copied and edited for customization. ```bash igittigitt config-generate-examples ``` -------------------------------- ### Install igittigitt as a project dependency Source: https://github.com/bitranox/igittigitt/blob/master/INSTALL.md Sets up a virtual environment and installs `igittigitt` as a project dependency using `uv`. ```bash # install the CLI tool (isolated environment, added to PATH) uv venv && source .venv/bin/activate # Windows: .venv\Scripts\Activate.ps1 uv pip install igittigitt ``` -------------------------------- ### Install igittigitt Source: https://github.com/bitranox/igittigitt/blob/master/notebooks/Quickstart.ipynb Installs the igittigitt package and its dependencies. Use this to set up the library for use. ```python import sys !{sys.executable} -m pip install --upgrade pip # install igittigitt from GitHub (or use: igittigitt from PyPI) !{sys.executable} -m pip install --upgrade git+https://github.com/bitranox/igittigitt.git ``` -------------------------------- ### Install uv (Windows PowerShell) Source: https://github.com/bitranox/igittigitt/blob/master/INSTALL.md Installs the `uv` package manager on Windows systems using PowerShell. ```powershell # Windows (PowerShell) powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex" ``` -------------------------------- ### Install Development Dependencies Source: https://github.com/bitranox/igittigitt/blob/master/DEVELOPMENT.md Installs the necessary development extras for the project. This is a prerequisite for running the interactive menu and other development tasks. ```bash pip install -e .[dev] ``` -------------------------------- ### Build and install from build artifacts Source: https://github.com/bitranox/igittigitt/blob/master/INSTALL.md Builds the Python package using `build` and then installs the generated wheel or source distribution. ```bash python -m build pip install dist/igittigitt-*.whl pip install dist/igittigitt-*.tar.gz # sdist ``` -------------------------------- ### Install igittigitt via pip Source: https://github.com/bitranox/igittigitt/blob/master/INSTALL.md Installs `igittigitt` from PyPI or GitHub using `pip`, with options for virtual environments and development installs. ```bash # optional, install in a venv (recommended) python -m venv .venv source .venv/bin/activate # Windows: .venv\Scripts\activate # install from PyPI pip install igittigitt # optional install from GitHub pip install "git+https://github.com/bitranox/igittigitt" # optional development install from local pip install -e ".[dev]" # optional install from local runtime only: pip install . ``` -------------------------------- ### Install igittigitt as a Standalone CLI Tool Source: https://github.com/bitranox/igittigitt/blob/master/skills/python-gitignore/SKILL.md Install igittigitt as a standalone command-line interface tool using 'uv tool install'. This makes the CLI available globally on your PATH. ```bash uv tool install igittigitt ``` -------------------------------- ### Create System-Wide Configuration Fragment Source: https://github.com/bitranox/igittigitt/blob/master/skills/python-gitignore/SKILL.md This example shows how to create a system-wide configuration fragment on Linux to override settings. It demonstrates creating a directory and editing a TOML file. ```bash sudo mkdir -p /etc/xdg/igittigitt/config.d sudoedit /etc/xdg/igittigitt/config.d/50-myperf.toml ``` -------------------------------- ### Example Performance Configuration Source: https://github.com/bitranox/igittigitt/blob/master/skills/python-gitignore/SKILL.md This TOML snippet illustrates how to configure performance-related settings, such as increasing the directory cache size for deep directory trees. ```toml # /etc/xdg/igittigitt/config.d/50-myperf.toml [performance] dir_cache_max = 32768 # larger directory cache for very deep trees ``` -------------------------------- ### Install Development Tools Source: https://github.com/bitranox/igittigitt/blob/master/CONTRIBUTING.md Automatically install missing development tools like Ruff, Pyright, or Pytest. Skip this step by setting the `SKIP_BOOTSTRAP` environment variable. ```bash pip install -e .[dev] ``` ```bash SKIP_BOOTSTRAP=1 pip install -e .[dev] ``` -------------------------------- ### Install uv (macOS/Linux) Source: https://github.com/bitranox/igittigitt/blob/master/INSTALL.md Installs the `uv` package manager on macOS and Linux systems using a curl script. ```bash # macOS/Linux curl -LsSf https://astral.sh/uv/install.sh | sh ``` -------------------------------- ### Install igittigitt with Poetry or PDM Source: https://github.com/bitranox/igittigitt/blob/master/INSTALL.md Adds `igittigitt` as a dependency or installs it for local development using Poetry or PDM. ```bash # Poetry poetry add igittigitt # as dependency poetry install # for local dev # PDM pdm add igittigitt pdm install ``` -------------------------------- ### Install igittigitt directly from Git Source: https://github.com/bitranox/igittigitt/blob/master/INSTALL.md Installs `igittigitt` directly from its GitHub repository using `pip`. ```bash pip install "git+https://github.com/bitranox/igittigitt" ``` -------------------------------- ### Install igittigitt CLI tool with uv Source: https://github.com/bitranox/igittigitt/blob/master/INSTALL.md Installs the `igittigitt` CLI tool into an isolated environment and adds it to the system's PATH. ```bash # install the CLI tool (isolated environment, added to PATH) uv tool install igittigitt # upgrade to latest uv tool upgrade igittigitt ``` -------------------------------- ### Per-User Installation of igittigitt with pip Source: https://github.com/bitranox/igittigitt/blob/master/INSTALL.md Installs `igittigitt` for the current user without a virtual environment, from PyPI, GitHub, or local source. ```bash # install from PyPI pip install --user igittigitt # optional install from GitHub pip install --user "git+https://github.com/bitranox/igittigitt" # optional install from local pip install --user . ``` -------------------------------- ### Verify igittigitt installation Source: https://github.com/bitranox/igittigitt/blob/master/INSTALL.md Confirms that the `igittigitt` CLI command is available and executable after installation. ```bash igittigitt --version ``` -------------------------------- ### Install igittigitt as a Project Dependency Source: https://github.com/bitranox/igittigitt/blob/master/skills/python-gitignore/SKILL.md Use 'uv add' to install igittigitt as a dependency for your Python project. This is the recommended installation method. ```bash uv add igittigitt ``` -------------------------------- ### Configure Email Integration Tests Source: https://github.com/bitranox/igittigitt/blob/master/DEVELOPMENT.md Sets up the necessary environment variables for running email integration tests. Copy the example file and fill in your SMTP server details. ```bash # .env (copy from .env.example) EMAIL__SMTP_HOSTS=smtp.example.com:587 EMAIL__FROM_ADDRESS=sender@example.com EMAIL__RECIPIENTS=recipient@example.com EMAIL__SMTP_USER=your_username EMAIL__SMTP_PASSWORD=your_password ``` -------------------------------- ### Install igittigitt using pip or pipx Source: https://github.com/bitranox/igittigitt/blob/master/skills/python-gitignore/SKILL.md Alternative installation methods for igittigitt using standard Python package managers like pip and pipx. ```bash pip install igittigitt ``` ```bash pipx install igittigitt ``` -------------------------------- ### Launch Interactive Menu Source: https://github.com/bitranox/igittigitt/blob/master/DEVELOPMENT.md Starts the Textual-based Text User Interface (TUI) for browsing targets, editing parameters, and running commands with live output. ```bash make menu ``` -------------------------------- ### Run igittigitt with uvx Source: https://github.com/bitranox/igittigitt/blob/master/INSTALL.md Executes the `igittigitt` CLI tool temporarily in an isolated environment without global installation using `uvx`. ```bash uvx igittigitt@latest --help ``` -------------------------------- ### Get igittigitt Package Metadata Source: https://github.com/bitranox/igittigitt/blob/master/skills/python-gitignore/SKILL.md Display package metadata using the `info` command. ```bash igittigitt info # package metadata ``` -------------------------------- ### Run igittigitt CLI Once Without Installation Source: https://github.com/bitranox/igittigitt/blob/master/skills/python-gitignore/SKILL.md Execute the igittigitt CLI command once without a formal installation using 'uvx'. This is useful for quick checks or one-off operations. ```bash uvx igittigitt --help ``` -------------------------------- ### Install Claude Code Skill for igittigitt Source: https://github.com/bitranox/igittigitt/blob/master/README.md Use these commands to add and install the igittigitt skill from the Claude Code plugin marketplace. This skill enables Claude to manage igittigitt. ```text /plugin marketplace add bitranox/igittigitt ``` ```text /plugin install igittigitt ``` -------------------------------- ### Mark OS Constraints in Tests Source: https://github.com/bitranox/igittigitt/blob/master/CONTRIBUTING.md Use pytest markers to specify operating system constraints for tests. Examples include `@pytest.mark.os_agnostic` and `@pytest.mark.os_windows`. ```python @pytest.mark.os_agnostic def test_something_os_agnostic(): pass @pytest.mark.os_windows def test_something_windows_only(): pass ``` -------------------------------- ### Set Performance Knob via .env File Source: https://github.com/bitranox/igittigitt/blob/master/skills/python-gitignore/SKILL.md Shows how to set a performance knob using a `.env` file. The format uses double underscores to separate nested configuration keys. ```bash PERFORMANCE__DIR_CACHE_MAX=32768 ``` -------------------------------- ### Inspect Merged Configuration Source: https://github.com/bitranox/igittigitt/blob/master/CONFIG.md Use this command to view the currently merged configuration settings, including their provenance. ```bash igittigitt config ``` -------------------------------- ### Include / Whitelist Mode Source: https://github.com/bitranox/igittigitt/blob/master/notebooks/Quickstart.ipynb Shows how to use the IncludeParser to specify files to keep, effectively whitelisting them. ```python inc = igittigitt.IncludeParser() inc.add_rule("*.py", base_path="/home/user/project") print("deep .py kept:", inc.match("/home/user/project/pkg/deep.py")) ``` -------------------------------- ### Deploy Editable Configuration Files Source: https://github.com/bitranox/igittigitt/blob/master/CONFIG.md This command deploys editable copies of the configuration files to standard directories, allowing for customization. ```bash igittigitt config-deploy ``` -------------------------------- ### Parse .gitignore Rules and Match Paths Source: https://github.com/bitranox/igittigitt/blob/master/skills/python-gitignore/SKILL.md Demonstrates how to initialize an IgnoreParser, parse .gitignore files recursively from a base directory, add custom rules, and check if a given path is ignored. ```python import igittigitt parser = igittigitt.IgnoreParser() # discover and parse every .gitignore under base_dir (correct per-directory precedence) parser.parse_rule_files(base_dir="/path/to/project") # or add rules explicitly (last matching rule wins, exactly like git) parser.add_rule("*.py[cod]", base_path="/path/to/project") parser.add_rule("!keep.pyc", base_path="/path/to/project") parser.match("/path/to/project/main.pyc") # True -> ignored parser.match("/path/to/project/keep.pyc") # False -> re-included by the negation ``` -------------------------------- ### Run Tests with Different Configurations Source: https://github.com/bitranox/igittigitt/blob/master/DEVELOPMENT.md Execute the test suite with options to skip bootstrap, enable/disable coverage, or force coverage generation. This is useful for local development and debugging test issues. ```bash make test # ruff + pyright + pytest + coverage (default ON) SKIP_BOOTSTRAP=1 make test # skip auto-install of dev deps COVERAGE=off make test # disable coverage locally COVERAGE=on make test # force coverage and generate coverage.xml/codecov.xml ``` -------------------------------- ### Set Performance Knob via Command Line Source: https://github.com/bitranox/igittigitt/blob/master/skills/python-gitignore/SKILL.md Demonstrates setting a specific performance knob, `dir_cache_max`, using the `--set` flag for ad-hoc configuration. ```bash igittigitt --set performance.dir_cache_max=32768 ... ``` -------------------------------- ### IgnoreParser Usage Source: https://github.com/bitranox/igittigitt/blob/master/README.md Demonstrates how to use the IgnoreParser class to discover, parse, and match ignore rules, and integrate it with shutil.copytree. ```APIDOC ## IgnoreParser ### Description The `IgnoreParser` class is used to discover and parse ignore rules from `.gitignore` files or to add rules explicitly. It can then be used to check if a file should be ignored or included. ### Methods - **`parse_rule_files(base_dir: str)`**: Discovers and parses all `.gitignore` files starting from the `base_dir`. - **`add_rule(rule: str, base_path: str)`**: Adds a specific ignore rule. - **`match(file_path: str)`**: Returns `True` if the `file_path` is ignored, `False` otherwise. - **`shutil_ignore`**: An attribute that can be used as the `ignore` argument for `shutil.copytree`. ### Example Usage ```python import igittigitt parser = igittigitt.IgnoreParser() # Discover and parse every .gitignore below base_dir (per-directory precedence) parser.parse_rule_files(base_dir="/home/user/project") # ... or add rules explicitly parser.add_rule("*.py[cod]", base_path="/home/user/project") parser.add_rule("!keep.pyc", base_path="/home/user/project") print(parser.match("/home/user/project/main.pyc")) # True (ignored) print(parser.match("/home/user/project/keep.pyc")) # False (re-included by the negation) # Use it as a shutil.copytree filter to copy a tree without the ignored files: import shutil shutil.copytree("src_tree", "dst_tree", ignore=parser.shutil_ignore) ``` ``` -------------------------------- ### IncludeParser Usage Source: https://github.com/bitranox/igittigitt/blob/master/README.md Illustrates how to use the IncludeParser class to keep only specified files and integrate it with shutil.copytree. ```APIDOC ## IncludeParser ### Description The `IncludeParser` class keeps only the files that match the specified rules; everything else is dropped. Including a directory keeps its whole subtree, and unanchored patterns are found at any depth. ### Methods - **`add_rule(rule: str, base_path: str)`**: Adds a specific inclusion rule. - **`match(file_path: str)`**: Returns `True` if the `file_path` matches an inclusion rule, `False` otherwise. - **`shutil_include`**: An attribute that can be used as the `ignore` argument for `shutil.copytree`. ### Example Usage ```python import shutil, igittigitt inc = igittigitt.IncludeParser() inc.add_rule("*.py", base_path="src_tree") # keep only python files... inc.add_rule("docs/", base_path="src_tree") # ...and the whole docs/ subtree # copy only the kept files (parent directories are descended into automatically) shutil.copytree("src_tree", "dst_tree", ignore=inc.shutil_include) print(inc.match("src_tree/pkg/deep.py")) # True (kept) ``` ``` -------------------------------- ### Ignore Mode with Negation Source: https://github.com/bitranox/igittigitt/blob/master/notebooks/Quickstart.ipynb Demonstrates how to use the IgnoreParser to specify files to ignore, including exceptions using negation rules. ```python import igittigitt parser = igittigitt.IgnoreParser() parser.add_rule("*.py[cod]", base_path="/home/user/project") parser.add_rule("!keep.pyc", base_path="/home/user/project") print("main.pyc ignored:", parser.match("/home/user/project/main.pyc")) print("keep.pyc ignored:", parser.match("/home/user/project/keep.pyc")) ``` -------------------------------- ### Set Performance Knob via Environment Variable Source: https://github.com/bitranox/igittigitt/blob/master/skills/python-gitignore/SKILL.md Illustrates setting a performance knob via an environment variable. This method uses triple underscores for nested keys, prefixed by the application name. ```bash IGITTIGITT___PERFORMANCE__DIR_CACHE_MAX=32768 ``` -------------------------------- ### Run Email Notification Command with Env File Source: https://github.com/bitranox/igittigitt/blob/master/DEVELOPMENT.md Executes the 'send-notification' command using a specified environment file for configuration. Useful for testing email functionality with custom settings. ```bash igittigitt --env-file /path/to/my/.env send-notification --subject "Test" --message "Hello" ``` -------------------------------- ### Run Local Tests with make test Source: https://github.com/bitranox/igittigitt/blob/master/CONTRIBUTING.md Execute the full linting, type checking, and testing pipeline locally. Coverage is enabled by default; use `COVERAGE=off` for a run without coverage. ```bash make test ``` ```bash COVERAGE=off make test ``` -------------------------------- ### Run All Tests Source: https://github.com/bitranox/igittigitt/blob/master/DEVELOPMENT.md Executes all tests in the project, including those marked with 'local_only', without any marker filtering. ```bash pytest tests/ ``` -------------------------------- ### Run Default Tests Source: https://github.com/bitranox/igittigitt/blob/master/DEVELOPMENT.md Executes all tests except those marked with 'local_only'. This is the default command for CI environments. ```bash make test ``` -------------------------------- ### Apply Inline Rules and Explicit Ignore Files Source: https://github.com/bitranox/igittigitt/blob/master/README.md Check paths against a combination of inline rules, explicit ignore files, and standard input. This is useful for applying custom ignore patterns or testing specific configurations. ```bash # inline rules and explicit ignore files igittigitt check -r '*.tmp' -f .gitignore --stdin < paths.txt ``` -------------------------------- ### Python Whitelist/Include Mode Usage Source: https://github.com/bitranox/igittigitt/blob/master/README.md Use IncludeParser to specify which files and directories to keep. This parser is useful for selectively copying files, ensuring only specified items are included. ```python import shutil, igittigitt inc = igittigitt.IncludeParser() inc.add_rule("*.py", base_path="src_tree") # keep only python files... inc.add_rule("docs/", base_path="src_tree") # ...and the whole docs/ subtree # copy only the kept files (parent directories are descended into automatically) shutil.copytree("src_tree", "dst_tree", ignore=inc.shutil_include) inc.match("src_tree/pkg/deep.py") # True (kept) ``` -------------------------------- ### Configure Codecov Token Source: https://github.com/bitranox/igittigitt/blob/master/CONTRIBUTING.md Set the Codecov token for private repositories. This can be done via environment variables or a `.env` file. ```bash export CODECOV_TOKEN="your_token_here" ``` ```bash # Add to .env file: CODECOV_TOKEN=your_token_here ``` -------------------------------- ### Run Specific Email Integration Test File Source: https://github.com/bitranox/igittigitt/blob/master/DEVELOPMENT.md Executes tests specifically from the email SMTP test file with verbose output. Useful for debugging email-related issues. ```bash pytest tests/test_cli_email_smtp.py -v ``` -------------------------------- ### Run Slow/Local Integration Tests Source: https://github.com/bitranox/igittigitt/blob/master/DEVELOPMENT.md Executes only the integration tests marked with 'local_only', which typically require external resources like SMTP servers or databases. ```bash make test-slow ``` -------------------------------- ### Include Mode for File Copying Source: https://github.com/bitranox/igittigitt/blob/master/skills/python-gitignore/SKILL.md Utilizes IncludeParser to specify which files and directories to keep, rather than which to ignore. This is useful for selective copying where only specific items should be preserved. ```python import shutil, igittigitt inc = igittigitt.IncludeParser() inc.add_rule("*.py", base_path="src_tree") # keep python files anywhere inc.add_rule("docs/", base_path="src_tree") # keep the whole docs/ subtree shutil.copytree("src_tree", "dst_tree", ignore=inc.shutil_include) inc.match("src_tree/pkg/deep.py") # True -> kept ``` -------------------------------- ### Push with Automatic Commit Source: https://github.com/bitranox/igittigitt/blob/master/CONTRIBUTING.md Performs a commit before pushing. It prompts for a message interactively, respects the `COMMIT_MESSAGE` environment variable, or creates an empty commit if nothing is staged. ```bash make push ``` ```bash COMMIT_MESSAGE="Your commit message" make push ``` -------------------------------- ### Set Logging Console Level via Environment Variable Source: https://github.com/bitranox/igittigitt/blob/master/README.md Configure the console logging level to DEBUG using an environment variable. This is an alternative to the --set flag. ```bash IGITTIGITT___LIB_LOG_RICH__CONSOLE_LEVEL=DEBUG ``` -------------------------------- ### Set Console Log Level via Environment Variable Source: https://github.com/bitranox/igittigitt/blob/master/CONFIG.md Overrides the minimum log level shown on the console using an environment variable. This command also performs an 'info' operation. ```bash IGITTIGITT___LIB_LOG_RICH__CONSOLE_LEVEL=DEBUG igittigitt info ``` -------------------------------- ### Check Ignored Paths Source: https://github.com/bitranox/igittigitt/blob/master/README.md Use this command to determine which of the specified paths are ignored by gitignore rules, similar to `git check-ignore`. It exits with 0 if any path is ignored, and 1 otherwise. ```bash # which of these paths are ignored? (like `git check-ignore`) igittigitt check -C /path/to/repo a.log src/main.py # exit 0 if at least one path is ignored, 1 if none # show the matching rule (source:line:pattern), like `git check-ignore -v` igittigitt check -C /path/to/repo -v a.log ``` -------------------------------- ### Set Maximum Token Bytes via Environment Variable Source: https://github.com/bitranox/igittigitt/blob/master/CONFIG.md Overrides the per-token safety bound using an environment variable. A token larger than this limit will be rejected. ```bash IGITTIGITT___PERFORMANCE__MAX_TOKEN_BYTES=4096 igittigitt check -C repo --stdin < paths ``` -------------------------------- ### Copy Directory Tree Ignoring Gitignore Rules Source: https://github.com/bitranox/igittigitt/blob/master/skills/python-gitignore/SKILL.md Use the IgnoreParser's `shutil_ignore` method as a callback for `shutil.copytree` to copy a directory while respecting .gitignore rules. ```python import shutil, igittigitt parser = igittigitt.IgnoreParser() parser.parse_rule_files(base_dir="src_tree") shutil.copytree("src_tree", "dst_tree", ignore=parser.shutil_ignore) ``` -------------------------------- ### Mark Test for Local Execution Source: https://github.com/bitranox/igittigitt/blob/master/DEVELOPMENT.md Marks a test function to be run only when 'make test-slow' is executed, indicating it requires external resources. Also marks it as OS-agnostic. ```python @pytest.mark.local_only @pytest.mark.os_agnostic def test_real_external_service(...): """Integration test requiring external service.""" ... ``` -------------------------------- ### Set Console Log Level Source: https://github.com/bitranox/igittigitt/blob/master/CONFIG.md Overrides the minimum log level shown on the console using the --set flag. This command also performs an 'info' operation. ```bash igittigitt --set lib_log_rich.console_level=DEBUG info ``` -------------------------------- ### Filter Paths with Igittigitt Source: https://github.com/bitranox/igittigitt/blob/master/README.md This command acts as a Unix filter, reading paths from standard input and printing only those that are not ignored. It supports NUL-separated I/O for handling paths with special characters and can operate in an include-only mode. ```bash # Unix filter: drop ignored paths from a stream find . -type f | igittigitt filter # keep only what matches the include patterns find . -type f | igittigitt filter --include -r '*.py' # NUL-separated I/O for paths with spaces/newlines find . -print0 | igittigitt filter -z | xargs -0 ... ``` -------------------------------- ### Python Ignore Mode Usage Source: https://github.com/bitranox/igittigitt/blob/master/README.md Use IgnoreParser to parse .gitignore files and apply rules to match files. This is useful for filtering files during operations like copying directory trees. ```python import igittigitt parser = igittigitt.IgnoreParser() # discover and parse every .gitignore below base_dir (per-directory precedence) parser.parse_rule_files(base_dir="/home/user/project") # ... or add rules explicitly parser.add_rule("*.py[cod]", base_path="/home/user/project") parser.add_rule("!keep.pyc", base_path="/home/user/project") parser.match("/home/user/project/main.pyc") # True (ignored) parser.match("/home/user/project/keep.pyc") # False (re-included by the negation) ``` ```python import shutil, igittigitt parser = igittigitt.IgnoreParser() parser.parse_rule_files(base_dir="src_tree") shutil.copytree("src_tree", "dst_tree", ignore=parser.shutil_ignore) ``` -------------------------------- ### Filter Paths with igittigitt Bash Piping Source: https://github.com/bitranox/igittigitt/blob/master/skills/python-gitignore/SKILL.md Use `igittigitt filter` as a Unix filter to process paths from stdin. It streams output, remaining memory-bounded for large inputs and handling SIGPIPE cleanly. ```bash # drop paths ignored by ./.gitignore find . -type f | igittigitt filter # keep only what matches the include patterns (whitelist mode) find . -type f | igittigitt filter --include -r '*.py' # NUL-separated I/O for paths with spaces or newlines find . -print0 | igittigitt filter -z | xargs -0 tar czf out.tgz # stops cleanly when the reader closes the pipe (no traceback) find . -type f | igittigitt filter | head -n 20 ``` -------------------------------- ### Set Performance Cache Size Source: https://github.com/bitranox/igittigitt/blob/master/CONFIG.md Overrides the directory-decision LRU capacity for the parser using the --set flag. This affects speed and cache memory. ```bash igittigitt --set performance.dir_cache_max=32768 filter -C repo ``` -------------------------------- ### Check Ignored Paths with igittigitt CLI Source: https://github.com/bitranox/igittigitt/blob/master/skills/python-gitignore/SKILL.md Use `igittigitt check` to determine if specified paths are ignored by gitignore rules. The `-v` flag shows the matching rule. ```bash # which of these paths are ignored? (mirrors `git check-ignore`) igittigitt check -C /path/to/repo a.log src/main.py # exit 0 if any ignored, 1 if none # show the matching source:line:pattern (like `git check-ignore -v`) igittigitt check -C /path/to/repo -v a.log # inline rules and explicit ignore files, reading paths from stdin igittigitt check -r '*.tmp' -f .gitignore --stdin < paths.txt ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.