Skip to main content

CLI tool for Git-style file filtering and copying with include/exclude pattern management

Project description

Ignorely

A flexible CLI tool for filtering and copying files using include/exclude patterns, similar to Git's ignore functionality.

Features

  • File Filtering: List files using include/exclude patterns
  • File Copying: Copy filtered files with various options
  • Unified Export: Filter and copy files in one command
  • Pattern Management: Support for multiple pattern files via table-of-contents files
  • Flexible Output: Support for flat or hierarchical directory structures
  • Dry Run Mode: Preview operations before executing

Installation

pip install ignorely

Or install from source:

git clone <repository-url>
cd ignorely
pip install .

Quick Start

  1. Create pattern files in .ignorely/ directory:

    mkdir .ignorely
    echo ".gitignore" > .ignorely/exclude_tot
    echo "include_patterns.txt" > .ignorely/include_tot
    
  2. List filtered files:

    ignorely ls-files
    
  3. Export filtered files to a directory:

    ignorely export-files output/
    

Commands

ls-files - List filtered files

List files with include/exclude filtering.

ignorely ls-files [OPTIONS]

Options:

  • -o, --output FILE: Save output to file instead of displaying
  • -e, --exclude-tot FILE: File containing exclude pattern files (default: .ignorely/exclude_tot)
  • -i, --include-tot FILE: File containing include pattern files (default: .ignorely/include_tot)

Examples:

# List all filtered files
ignorely ls-files

# Save file list to output.txt
ignorely ls-files -o output.txt

# Use custom pattern files
ignorely ls-files -e custom_exclude.txt -i custom_include.txt

copy-files - Copy files from list

Copy files to output directory based on provided file list.

ignorely copy-files OUTPUT_DIR [OPTIONS]

Options:

  • -l, --list-file FILE: Read file list from file
  • -d, --dry-run: Show what would be copied without actually copying
  • --flatten: Flatten directory structure using divider in filenames
  • --divider CHAR: Character to use as path divider when flattening (default: %)
  • -c, --clean: Clean (remove) output directory before copying

Examples:

# Copy files from stdin
ignorely ls-files | ignorely copy-files output/

# Copy files from file list
ignorely copy-files output/ -l files.txt

# Dry run to preview operations
ignorely copy-files output/ -l files.txt --dry-run

# Flatten directory structure
ignorely copy-files output/ -l files.txt --flatten

# Clean output directory before copying
ignorely copy-files output/ -l files.txt --clean

export-files - Filter and copy in one step

Combines ls-files and copy-files functionality.

ignorely export-files OUTPUT_DIR [OPTIONS]

Options:

  • -e, --exclude-tot FILE: File containing exclude pattern files (default: .ignorely/exclude_tot)
  • -i, --include-tot FILE: File containing include pattern files (default: .ignorely/include_tot)
  • -d, --dry-run: Show what would be copied without actually copying
  • --flatten: Flatten directory structure using divider in filenames
  • --divider CHAR: Character to use as path divider when flattening (default: %)
  • -c, --clean: Clean (remove) output directory before copying

Examples:

# Export filtered files
ignorely export-files output/

# Export with flattened structure
ignorely export-files output/ --flatten

# Dry run export
ignorely export-files output/ --dry-run

# Clean and export
ignorely export-files output/ --clean

Pattern Files

Ignorely uses "table-of-contents" files to manage multiple pattern files:

Exclude Table-of-Contents (.ignorely/exclude_tot)

Lists pattern files containing exclusion rules:

.gitignore
.dockerignore
custom_exclude.txt

Include Table-of-Contents (.ignorely/include_tot)

Lists pattern files containing inclusion rules:

include_patterns.txt
important_files.txt

Pattern File Format

Pattern files use Git-style wildcard patterns:

# This is a comment
*.log
temp/
**/node_modules/
!important.log

Pattern Matching

Ignorely uses the same pattern matching as Git:

  • *: Matches any number of characters except /
  • **: Matches any number of characters including /
  • ?: Matches any single character except /
  • !: Negates a pattern (include instead of exclude)
  • #: Comments (ignored)

Examples

Basic Usage

# Create basic setup
mkdir .ignorely
echo ".gitignore" > .ignorely/exclude_tot
echo "*.py" > include_python.txt
echo "include_python.txt" > .ignorely/include_tot

# List Python files not in .gitignore
ignorely ls-files

# Export Python files to dist/
ignorely export-files dist/

Advanced Filtering

# Multiple exclude patterns
cat > .ignorely/exclude_tot << EOF
.gitignore
.dockerignore
build_ignore.txt
EOF

# Multiple include patterns
cat > .ignorely/include_tot << EOF
source_files.txt
docs_files.txt
EOF

# Export with flattened structure
ignorely export-files release/ --flatten --divider=__

Pipeline Usage

# Filter and process files
ignorely ls-files | grep "\.py$" | ignorely copy-files python_files/

# Export specific patterns
ignorely export-files backup/ -e custom_exclude.txt

Dependencies

  • cleo: CLI framework
  • pathspec: Git-style pattern matching

Requirements

  • Python >= 3.10

License

[Add your license information here]

Contributing

[Add contributing guidelines here]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ignorely-1.3.0.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ignorely-1.3.0-py3-none-any.whl (12.4 kB view details)

Uploaded Python 3

File details

Details for the file ignorely-1.3.0.tar.gz.

File metadata

  • Download URL: ignorely-1.3.0.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.0

File hashes

Hashes for ignorely-1.3.0.tar.gz
Algorithm Hash digest
SHA256 4670608316f3edd300f06389ef3bcceaf1100adea3db7863e3f0d201ca1590a0
MD5 deec18bffc52de71e8acb37e2f4ffa5a
BLAKE2b-256 bb8bf0f02534c30853f387f23257ac593a26064b4a33bf50001e0d13c77ce39d

See more details on using hashes here.

File details

Details for the file ignorely-1.3.0-py3-none-any.whl.

File metadata

  • Download URL: ignorely-1.3.0-py3-none-any.whl
  • Upload date:
  • Size: 12.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.0

File hashes

Hashes for ignorely-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 619de0f22f077296ad7e44f27891fa194e1285e0c00cd105a9bbfd8f5a9ab809
MD5 9a1dd3e7646d40515fd8169053357f38
BLAKE2b-256 a1ed92506eddb43161f48bf2dcd02685d6d551e30f04c7a402fadfc2e96597d1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page