A simple command-line application for creating, reading, updating, deleting, and listing tasks.
Built with Rust, using the following modules:
- models: Defines the Task data structure and manages file I/O via the TaskManager.
- commands: Contains the core subcommand handlers (create, read, update, delete, list).
- cli: Configures the command-line interface using Clap, mapping subcommands to handler functions.
- main.rs: Initializes the TaskManager and dispatches subcommands.
- The application loads tasks from a JSON file (data/todos.json) into an in-memory Vec.
- Users run a subcommand (e.g., create, read, update, delete, list) from the CLI.
- Each subcommand calls a handler in the commands/ module, which in turn uses TaskManager to manipulate data.
- The updated tasks are written back to JSON, preserving changes between runs.
- Install Rust (version 1.68+ recommended).
- Install Git (latest version).
- Clone or download this repository.
git clone https://github.com/KeebyResearch/TODO-CLI-Tool.git
- Navigate to the project root folder (where Cargo.toml is located) and run:
cd Rust-TODO-CLI
cargo build
Run the CLI from the project root directory with:
cargo run [SUBCOMMAND]
Available subcommands:
- create: Add a new task.
Example:cargo run create --title "Buy Groceries" --description "Milk, Eggs, Bread"
- read: Display a specific task by ID.
Example:cargo run read 1
- update: Update an existing task.
Example:cargo run update 1 --title "New Title"
- delete: Remove a task by ID.
Example:cargo run delete 1
- list: Show all tasks.
Example:cargo run list
- help: Show all subcommands information.
Example:cargo run help
- data/
todos.json
: JSON file storing all tasks (created automatically if it doesn't exist).
- src/models
task.rs
: Task data and serialization.task_manager.rs
: Methods to create, read, update, delete, and list tasks.
- src/commands
- One file per subcommand (create, read, update, delete, list), each with a handler function.
- src/cli
app.rs
: Builds the Clap-based CLI.mod.rs
: Re-exports app for easy access.
- main.rs
- Initializes TaskManager from data/todos.json.
- Parses CLI input.
- Dispatches subcommands to the corresponding handlers.
- Always run commands from the project root directory (where
Cargo.toml
is located) - The
data/
folder should be in the project root alongsidesrc/
- Tasks are automatically saved to
data/todos.json
after each operation
Feel free to extend this CLI or use it as a base for more advanced Rust projects!