You need to have npm installed in your computer for this problem. It comes with Node.js and you can get it by installing Node from https://nodejs.org/en/
Run npm install to install all dependencies.
To create a symbolic link on Windows, you'll need to run either the Windows Command Prompt, or Windows Powershell with administrator privileges. To do so, right-click on the icon for Command Prompt, or Powershell, and choose the "Run as Administrator" option.
Command Prompt:
> mklink todo todo.bat
Powershell:
> cmd /c mklink todo todo.bat
Run the following command in your shell:
$ ln -s todo.sh todo
Executing the command without any arguments, or with a single argument help prints the CLI usage.
$ ./todo help
Usage :-
$ ./todo add "todo item" # Add a new todo
$ ./todo ls # Show remaining todos
$ ./todo del NUMBER # Delete a todo
$ ./todo done NUMBER # Complete a todo
$ ./todo help # Show usage
$ ./todo report # Statistics
The app can be run in the console with ./todo.
Use the ls command to see all the todos that are not yet complete. The most recently added todo should be displayed first.
$ ./todo ls
[2] change light bulb
[1] water the plants
Use the add command. The text of the todo item should be enclosed within double quotes (otherwise only the first word is considered as the todo text, and the remaining words are treated as different arguments).
$ ./todo add "the thing i need to do"
Added todo: "the thing i need to do"
Use the del command to remove a todo item by its number.
$ ./todo del 3
Deleted todo #3
Attempting to delete a non-existent todo item should display an error message.
$ ./todo del 5
Error: todo #5 does not exist. Nothing deleted.
Use the done command to mark a todo item as completed by its number.
$ ./todo done 1
Marked todo #1 as done.
Attempting to mark a non-existed todo item as completed will display an error message.
$ ./todo done 5
Error: todo #5 does not exist.
Use the report command to see the latest tally of pending and completed todos.
$ ./todo report
yyyy-mm-dd Pending : 1 Completed : 4