|
| 1 | +# Copilot Instructions |
| 2 | + |
| 3 | +This repository contains an interactive sorting utility that allows users to sort lines of text with various options similar to the Unix `sort` command. |
| 4 | + |
| 5 | +## Project Overview |
| 6 | + |
| 7 | +The `interactive-sort` tool provides: |
| 8 | +- Interactive line-by-line sorting as users type |
| 9 | +- Multiple sorting modes (alphabetical, numeric, human-readable numbers, month-based) |
| 10 | +- Various options like case-insensitive sorting, unique filtering, reverse sorting |
| 11 | +- Field separator support for structured data |
| 12 | + |
| 13 | +## Development Guidelines |
| 14 | + |
| 15 | +### Code Style |
| 16 | +- Follow PEP 8 Python style guidelines |
| 17 | +- Use ruff for code formatting with 120 character line length |
| 18 | +- Keep functions focused and well-documented |
| 19 | +- Use type hints where appropriate |
| 20 | + |
| 21 | +### Testing |
| 22 | +- Use tox for testing across multiple Python versions (3.8+) |
| 23 | +- Write unit tests for new functionality |
| 24 | +- Ensure all tests pass before submitting changes |
| 25 | +- Test interactive functionality manually when possible |
| 26 | + |
| 27 | +### Project Structure |
| 28 | +- Keep the project simple and focused |
| 29 | +- Main functionality should remain in a single module for simplicity |
| 30 | +- Package properly for pip installation |
| 31 | +- Use standard Python packaging tools (setuptools, pyproject.toml) |
| 32 | + |
| 33 | +### CI/CD |
| 34 | +- All changes are tested via GitHub Actions |
| 35 | +- tox runs on every push to master branch |
| 36 | +- Code formatting is checked with ruff |
| 37 | +- Tests must pass for all supported Python versions |
| 38 | + |
| 39 | +### Making Changes |
| 40 | +- Make minimal, focused changes |
| 41 | +- Preserve existing functionality unless specifically changing it |
| 42 | +- Update documentation if adding new features |
| 43 | +- Ensure backward compatibility for command-line interface |
| 44 | + |
| 45 | +### Interactive Sorting Algorithm |
| 46 | +The core functionality uses: |
| 47 | +- `bisect.insort_left()` for efficient insertion into sorted lists |
| 48 | +- Custom comparison functions for different sorting modes |
| 49 | +- Real-time display updates after each input line |
| 50 | + |
| 51 | +### Dependencies |
| 52 | +- Keep external dependencies minimal |
| 53 | +- Use only standard library when possible |
| 54 | +- Document any new dependencies clearly |
| 55 | + |
| 56 | +## Supported Features |
| 57 | +- Case-insensitive sorting (`-f`, `--ignore-case`) |
| 58 | +- Ignore non-printing characters (`-i`, `--ignore-nonprinting`) |
| 59 | +- Month-based sorting (`-M`, `--month-sort`) |
| 60 | +- Human-readable numeric sorting (`-H`, `--human-numeric-sort`) |
| 61 | +- Standard numeric sorting (`-n`, `--numeric-sort`) |
| 62 | +- Reverse sorting (`-r`, `--reverse`) |
| 63 | +- Unique filtering (`-u`, `--unique`) |
| 64 | +- Field separator support (`-t`, `--field-separator`) |
| 65 | + |
| 66 | +## Installation and Usage |
| 67 | +Users can install via pip and run as a command-line tool. See README.md for detailed installation and usage instructions. |
0 commit comments