Metadata-Version: 2.4
Name: file_query_text
Version: 0.1.4
Summary: SQL-like interface for querying files in your filesystem
Author-email: nik <42a11b@nikdav.is>
License-Expression: MIT
Project-URL: Homepage, https://github.com/nikdavis/file_query_text
Project-URL: Bug Tracker, https://github.com/nikdavis/file_query_text/issues
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Requires-Python: >=3.12
Description-Content-Type: text/markdown
Requires-Dist: pyparsing>=3.2.3
Requires-Dist: gitignore-parser>=0.1.12
Provides-Extra: dev
Requires-Dist: pytest>=8.3.5; extra == "dev"

# File Query

A SQL-like interface for querying files in your filesystem.

## Installation

```bash
# Clone the repository
git clone https://github.com/yourusername/file-query.git
cd file-query

# Install with pip
pip install -e .

# Or use UV
uv run python -m src.cli "your query"

# Install as a permanent tool with UV
uv tool install .
# This will install the 'fq' command
```

## Usage

### Command Line

The quickest way to run file-query is with UV:

```bash
uv run python -m src.cli "your query here"
```

After installation, you can use the shorthand command:

```bash
fq "your query here"
```

#### Basic Usage

```bash
# Find all Python files
fq "extension == 'py'"

# Find all text files and show their content
fq "extension == 'txt'" --show-content
```

#### Advanced Queries

File Query supports full SQL-like syntax:

```bash
# Find all Python files in the src directory
fq "SELECT * FROM 'src' WHERE extension == 'py'"

# Find all files larger than 100KB
fq "SELECT * FROM '.' WHERE size > 102400"

# Complex conditions
fq "SELECT * FROM '.' WHERE (extension == 'pdf' AND size > 1000000) OR (extension == 'txt' AND NOT name == 'README.txt')"
```

## Query Syntax

File Query uses a SQL-like syntax:

```sql
SELECT * FROM 'directory_path' WHERE condition
```

### Available Attributes

- `extension`: File extension (without the dot)
- `name`: Filename with extension
- `size`: File size in bytes
- `path`: Full file path

### Operators

- Comparison: `==`, `!=`, `<`, `<=`, `>`, `>=`
- Logical: `AND`, `OR`, `NOT`

## Examples

```bash
# Find all PDF files
fq "extension == 'pdf'"

# Find all files not named "main.py"
fq "NOT name == 'main.py'"

# Find all large image files
fq "SELECT * FROM '.' WHERE (extension == 'jpg' OR extension == 'png') AND size > 500000"

# Find files with 'config' in their path
fq "path == '.*config.*'"
```
