A command-line tool for common file operations.
- Create files (empty or with content)
- Copy files
- Combine two files into one
- Delete files
- Error handling and logging
- Complete test coverage
file-tool/
├── debian/
│ ├── control # Package metadata
│ ├── copyright # License information
│ └── changelog # Version history
├── src/
│ ├── operations/
│ │ └── file_operations.py # Core file operation implementations
│ ├── utils/
│ │ ├── exceptions.py # Custom exceptions
│ │ └── helpers.py # Utility functions
│ └── main.py # CLI application entry point
├── tests/
│ ├── conftest.py # Test configurations and fixtures
│ ├── test_file_operations.py # File operations tests
│ ├── test_helpers.py # Utility function tests
│ └── test_main.py # CLI interface tests
├── .dockerignore
├── .gitignore
├── Dockerfile
├── LICENSE
├── README.md
├── file-tool.spec
├── poetry.lock
├── pyproject.toml
├── sonar-project.properties
├── requirements.txt
└── requirements-dev.txt
-
Install Poetry:
curl -sSL https://install.python-poetry.org | python3 - -
Verify Poetry Installation:
poetry --version
Should see
Poetry (version 1.x.x)
-
Clone and install:
git clone https://github.com/spacepirate0001/file-tool.git cd file-tool poetry install --with dev
You can download the prebuilt standalone executable for Linux from the releases:
-
Download the latest release:
# Get the latest release LATEST_VERSION=$(curl -s https://api.github.com/repos/spacepirate0001/file-tool/releases/latest | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/') # Download the tarball wget https://github.com/spacepirate0001/file-tool/releases/download/${LATEST_VERSION}/file-tool-${LATEST_VERSION#v}-linux-x64.tar.gz
-
Extract the tarball:
tar -xzf file-tool-*-linux-x64.tar.gz -
Make sure file is executable:
chmod +x file-tool
-
Run the executable:
./file-tool
docker build -t file-tool .Once installed using Poetry, you can run commands directly:
file-tool [command] [options]If using Executable:
./file-tool [command] [options]If using Docker:
docker run file-tool [command] [options]Create an empty file:
file-tool create myfile.txtCreate a file with content:
file-tool create myfile.txt --content "Hello, World!"file-tool copy source.txt destination.txtCombines two files into a new file:
file-tool combine first.txt second.txt output.txtfile-tool delete myfile.txtfile-tool --help # Show general help
file-tool create --help # Show help for create command
file-tool copy --help # Show help for copy command
file-tool combine --help # Show help for combine command
file-tool delete --help # Show help for delete commandThis project includes configuration for development using VS Code Dev Containers, which provides a consistent, isolated development environment.
- Open the project in VS Code
- When prompted, click "Reopen in Container" or:
- Press F1, select "Dev Containers: Reopen in Container"
The container will:
- Set up a complete Python development environment
- Install all dependencies
- Configure VS Code with recommended extensions and settings
- Make the
file-toolcommand available
- Pre-configured Python development environment
- Integrated testing and debugging
- Code formatting and linting tools
- Test coverage visualization
- Consistent environment across different machines
If you prefer not to use Dev Containers, you can develop locally:
git clone https://github.com/spacepirate0001/file-tool.git
cd file-tool
poetry installRun all tests:
poetry run pytestRun tests with coverage:
poetry run pytest --cov=srcFormat code:
poetry run black src testsSort imports:
poetry run isort src testsType checking:
poetry run mypy srcThis project is licensed under the GNU Public License - see the LICENSE file for details.