Skip to main content

No project description provided

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.2.0.tar.gz (10.2 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.2.0-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for ignorely-1.2.0.tar.gz
Algorithm Hash digest
SHA256 3b2094fec9b331391192460b0c1ec772c07e196950d553fe8b6f8acbdfa9b487
MD5 05bfaf1bd2b28f1dffb4e28c7528d027
BLAKE2b-256 43e40549d14f58d7b51f107e11e994ed50ed7a3b377960c7c282cf1eef91c1b9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ignorely-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 9.3 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 eeb85ee32636fad168eeb3b0ca0af8b83e5519cce7557e51d3593c003245a353
MD5 342d39d691c33e262d740e452664e3ce
BLAKE2b-256 2b4a52a770aaa081a98020cb1ed9ef504f9df9aa30082da24f03f5a0f5672f6a

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