cli-fs is a simple CLI app for common file operations written in Rust. It uses the fli crate, which provides a simple and intuitive way to define command-line interfaces for your Rust applications.
cli-fs was developed as a showcase of some of the use cases of the fli
crate, which provides an easy-to-use framework for building command-line interfaces in Rust. It demonstrates how to perform common file operations such as listing the contents of a directory, moving files, creating files, speaking words, and writing to files.
This project is primarily intended as a demonstration and learning tool for using the fli
crate. While it provides basic functionality for file operations, it may not be suitable for production use without further enhancements and testing.
To use cli-fs, follow the steps below:
-
Clone the repository:
git clone https://github.com/codad5/cli-fs.git cd cli-fs
-
Build the application:
cargo build --release
-
Run the application:
cargo run --release
cli-fs provides the following commands:
-
ls
: List the contents of the current directory.- Options:
-b, --brief
: List the directory content in brief.
- Options:
-
move
: Move a file or directory to another location.- Options:
-f, --force
: Force move.
- Options:
-
create
: Create a new file.- Options:
-p, --put <content>
: Put content into the file.
- Options:
-
speak
: Speak a word or the content of a file.- Options:
-f, --file <filename>
: Speak the content of a file.
- Options:
-
write
: Write a word to a file.- Options:
-a, --append
: Append the word to the file.-f, --force
: Force the operation (no effect).
- Options:
-
List the contents of the current directory in brief:
./cli-fs ls -b
-
Move a file to another location:
./cli-fs move old_file.txt new_directory/
-
Create a new file with content:
./cli-fs create new_file.txt -p "Hello, world!"
-
Speak a word:
./cli-fs speak "Hello, world!"
-
Speak the content of a file:
./cli-fs speak -f filename.txt
-
Write a word to a file (append mode):
./cli-fs write filename.txt "Hello, world!" -a
-
Write a word to a file (overwrite mode, force has no effect):
./cli-fs write filename.txt "Hello, world!" -f
This project is licensed under the MIT License - see the LICENSE file for details.
- The
fli
crate used in this project is developed and maintained by Chibueze Aniezeofor. - Special thanks to Chibueze Aniezeofor for creating cli-fs and showcasing the capabilities of the
fli
crate.
Feel free to explore the code, experiment with the app, and use it as a reference for building your own CLI applications using the fli
crate. If you encounter any issues or have suggestions for improvements, please don't hesitate to open an issue or pull request on the GitHub repository.
Happy coding!