todo

Source ยป

Todo is a list management tool. It allows for appending, deleting, editing, and viewing your list in a variety of ways. Operation is done through line numbers and standard input or through command line flags.

$ todo -h Todo is a list management tool. Usage: todo [arguments] command filename The commands are: append append an item to the list delete delete an item in the list edit edit an existing list item init initialize a new todo list view view item(s) from the list The arguments are: -acat string append category. Used with {append} to specify the new item's category. Used with {edit} to overwrite an item's category. -adet string append details. Used with {append} to specify the new item's details. Used with {edit} to overwrite an item's details. -amess string append message. Used with {append} to specify the new item's message. Used with {edit} to overwrite an item's message. -apr int append priority. Used with {append} to specify the new item's priority. Used with {edit} to overwrite an item's priority. -n int the ID of the item to be operated on. When used with {edit} and {delete} it specifies the item which will be respectively overwritten or deleted. When used with {view} it instructs todo to show all an item's data. -v verbose output. When used with {view} todo will show all columns.

todo.go

Example

First you have to initialize an empty list.

$ ls -l
total 0
$ todo init todo.json
$ ls
todo.json

When appending, if you don't specify any flags, it will read through standard input.

$ todo append todo.json
Message: First todo item!
Details (reads until 'END'):
This can take multiple lines of input.
And will only be shown with {view} if you specify -v.
END
Category: programming
Priority: 2

Now, if we view our list, you will see the item has been added.

$ todo view todo.json
ID | Message          | Category    | Priority
-- ---------          ----------    ----------
1  | First todo item! | programming | 2
$ todo -v view todo.json
ID | Message          | Details                                                                                       | Category    | Priority
-- ---------          ---------                                                                                       ----------    ----------
1  | First todo item! | This can take multiple lines of input.\nAnd will only be shown with {view} if you specify -v. | programming | 2

But viewing the details isn't very pretty, especially because of the newlines. Instead lets view that particular item in a nicer way.

$ todo -v -n 1 view todo.json
ID        : 1
Message   : First todo item!
Details   : This can take multiple lines of input.
          | And will only be shown with {view} if you specify -v.
Category  : programming
Priority  : 2
$ todo -n 1 edit todo.json
ID        : 1
Message   : First todo item!
Details   : This can take multiple lines of input.
          | And will only be shown with {view} if you specify -v.
Category  : programming
Priority  : 2
Are you sure you want to overwrite this item? [y/N]: y
Message: New and improved todo item.
Details (reads until 'END'):
Just a short message.
END
Category: programming
Priority: 3
$ todo -n 1 delete todo.json
ID        : 1
Message   : New and improved todo item.
Details   : Just a short message.
Category  : programming
Priority  : 3
Are you sure you want to delete this item? [y/N]: y