Skip to content

Latest commit

 

History

26 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

file_handler

This is a command-line utility that can:

  • Create an empty file or a file with provided text
  • Copy a file
  • Combine multiple files into a single file
  • Delete a file

Installation

Ensure you have Python 3.8 or later installed.

python3 -m venv venv
. ./venv/bin/activate
pip3 install '.'

Usage

Ready to get started? With your virtual environment activated, run this to output help text:

file_handler

This will list commands you can use. Each command has its own help text. For example the create command has:

file_handler create --help

Sample commands

file_handler create --name="test1" --text="1\n"
file_handler create --name="test2" --text="2\n"
file_handler combine --input-file="test1" --input-file="test2" --output-file="test3"
file_handler copy --source="test1" --destination="test4"
file_handler delete --name="test1"
file_handler delete --name="test2"
file_handler delete --name="test3"
file_handler delete --name="test4"

Testing

Install the test code with:

pip3 install -e '.[test]'

Run the tests with:

python3 -m pytest

The tests use isolated_filesystem() which will automatically write and delete the files in a temporary directory. If you want the files to persist, you can switch to using isolated_filesystem(temp_dir='tmp') or similar. Be sure that the directory exists.

Each command has a corresponding test file in tests/.

Developing

Each command has a corresponding file in file_handler/commands/. The file name is used as the command name automatically. Docstrings are automatically included in command-line help text. Your best bet is to copy an existing file and modify it as needed to get started.

Notes

Some ideas for future development:

Inspiration

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages