This is a little personal project addressing my desire for a simple command line todo list. It is quite possible that such a program already exists with more capability, however, I thought this would be a fun little project to explore nonetheless. Feel free to try it out by cloning the source and building it locally, or download a binary from a release!
Primarily the focus of this project is to explore two things:
- the Rust programming language
- creating and deploying my own executable program on a linux system
At the time of writing a release is available directly for Linux systems.
See the Github Releases
section to retrieve this if on a Linux system.
Otherwise, install rustup
in order to be able to build the project.
See the appropriate steps for your system within The Cargo Book.
Clone the source from this repository.
git clone git@github.com:ayhaneyikan/todolist-cli.git
Build the project in release mode (includes optimizations).
cargo build --release
The created release will be available within the project at target/release/todo
.
Either add this binary to your PATH or move the binary to an existing PATH location.
Search online for best practices based on your operating system.
Once available on your command line, using the todo
tool is straightforward.
Any questions should be answerable using -h
or --help
on the command or any subcommands.
e.g.,
todo -h
todo tasks -h
The following section will highlight some key functionality of the todo
tool using an example project.
Lets create an example todo list for a school project.
# todo create <list-name>
todo create my-website
Our mock project is to create a website.
Note that list names must start with an english letter or a number and may only contain more of the same along with hyphens or underscores.
todo
will remind you of this if you attempt to create a list with an invalid name.
With todo
you can maintain several lists at once.
However, there is only ever one list at a time which is focused.
This functions similarly to how git
allows you to edit a single branch at a time.
We'll dive into the details of this in the following section.
Here's how you can view and switch between lists. There is also a shortcut for convenience...
# ALIASES:
# todo list
# todo ls
todo ls
# displays available lists e.g.,
# * my-website *
# we can create another list just to see it in this list
todo create another-list
todo ls
# displays available lists
# another-list
# * my-website *
# we can then switch to this new list
todo focus another-list
# this allows you to update the tasks within this list (see next section)
# notice how the todo ls output changes to reflect your focus
todo ls
# * another-list *
# my-website
# remove this unnecessary list
todo delete another-list
# re-type the list name to confirm the delete
# notice that after delete, todo automatically focused our other list
todo ls
# another-list
# * my-website *
Naturally we want to track items to do.
These are called Tasks
and we can easily add these to our list.
Like todo ls
above, this command has a shorter alias for convenience...
# ALIASES
# todo tasks
# todo ts
todo ts
# displays the list name and tasks in the list below that e.g.,
# -- my-website --
# clearly we have no tasks in our list
# add task(s) to the list
# we can add multiple at once, but note that they're separated by spaces
# lets add a task for each of the three pages we've been assigned for our website
todo add page1 page2 page3
todo ts
# -- my-website --
# 1| ✕ page1
# 2| ✕ page2
# 3| ✕ page3
# to add a task with a more descriptive name, use bash quotes (single or double)
# note that this lets you incorporate environment variables into tasks if you want
todo add 'Longer description of what we need'
todo add 'This time I want to add two tasks' "Here's the second one"
todo ts
# -- my-website --
# 1| ✕ page1
# 2| ✕ page2
# 3| ✕ page3
# 4| ✕ Longer description of what we need
# 5| ✕ This time I want to add two tasks
# 6| ✕ Here's the second one
# lets remove some of these silly tasks
# tasks are removed based on their index for simplicity
todo drop 6
todo drop 4 5 # note that indices may change after a previous removal
todo ts
# -- my-website --
# 1| ✕ page1
# 2| ✕ page2
# 3| ✕ page3
Mark one or more tasks as completed using...
# ALIASES
# todo done <task-index> ...
# todo do <task-index> ...
todo do 1 2
todo ts
# -- my-website --
# 1| ✓ page1
# 2| ✓ page2
# 3| ✕ page3
Oops! If you accidentally marked a task you shouldn't have, undo it...
# todo undo <task-index> ...
todo undo 2
todo ts
# -- my-website --
# 1| ✓ page1
# 2| ✕ page2
# 3| ✕ page3
Sometimes you may want to view tasks across all your lists (not just the one focused).
To do this, use the -a
option...
todo tasks -a
todo ts -a
It will output all lists with the tasks for that list directly below the list name.
When adding a task (or group of tasks) you can attach a date to those tasks.
Keep in mind this means attaching a single date to all tasks added in that command.
Do this using the -d
option.
This option parses common date formats and supports hyphens or forward slashes.
It will give you feeback if you provide an invalid date.
# lets imagine the project is due on the 30th
todo add 'website complete' 'website deployed' -d 4-30
todo ts
# -- my-website --
# 1| ✓ page1
# 2| ✕ page2
# 3| ✕ page3
# 4| ✕ [04/30] website complete
# 5| ✕ [04/30] website deployed
# tasks are sorted by date
# lets add a few more dates to see this in action
# these will ignore our website project example
todo add 'class start' --date 02/14
todo add mid-summer -d 06/25
# -- my-website --
# 1| ✓ page1
# 2| ✕ page2
# 3| ✕ page3
# 4| ✕ [02/14] class start
# 5| ✕ [04/30] website complete
# 6| ✕ [04/30] website deployed
# 7| ✕ [06/25] mid-summer
# years are also supported
# any date without a year specified will be assumed to be within the current year
todo add old-year -d 03/17/2001
todo add curr-year -d 03/17/2024
# -- my-website --
# 1| ✓ page1
# 2| ✕ page2
# 3| ✕ page3
# 4| ✕ [03/17/2001] old-year
# 5| ✕ [02/14] before
# 6| ✕ [03/17/2024] curr-year
# 7| ✕ [04/30] website complete
# 8| ✕ [04/30] website deployed
# 9| ✕ [06/25] after
Enjoy!