Skip to content

Latest commit

Β 

History

History
152 lines (104 loc) Β· 2.52 KB

File metadata and controls

152 lines (104 loc) Β· 2.52 KB

Simple Command Line Tool For Tasks

Local storage task CLI built with Commander

npm download

> npm i udemonia-to-do

For NPM package use after installing the NPM package

$ touch cli.js

In the cli.js file, require the package

const toDoCLI = require('udemonia-to-do')

The basic data structure of a to-do

[
  {
    "name": "Example Task",
    "dateAdded": "2021-06-08",
    "notes": "Example Notes - things to keep in mind",
    "completed": false,
    "dateCompleted": null
  }
]

Basic To Do Commands

Add a new to-do

> node cli.js new

You will be prompted for the name of the task and any notes you'd want to add

$ node cli.js new
? To Do
? Notes

Notes default to an empty string if you press enter without adding notes

You can also skip the 'To Do' prompt by adding the name after the new command

> node cli.js new My Task Title

Find all non-completed to-dos and mark them completed

> node cli.js new mc

note: this will update the completed to true while adding today's date as the date completed

[
  {
    "name": "Example Task",
    "dateAdded": "2021-06-08",
    "notes": "Example Notes - things to keep in mind",
    "completed": true,
    "dateCompleted": "2021-08-08"
  }
]

View all open to-dos

> node cli.js lo

View all completed to-dos

> node cli.js lc

Help

> node cli.js help
πŸ˜€ $node cli.js help
Usage: cli [options] [command]

to-do-cli

Options:
  -V, --version     output the version number
  -h, --help        display help for command

Commands:
  new|n             Add a new task to the list
  markComplete|mc   Mark a task as completed! βœ…
  listAll|la        List all the tasks (open & completed)
  listCompleted|lc  List all of the completed tasks βœ…
  listOpen|lo       List all the open tasks ❌
  help [command]    display help for command

~/.bash_profile alias

You can add an alias to your .bash_profile and run the alias from any directory

e.g.

Get the present working directory

> pwd

copy the present working directory, open vim or any other text editor and paste it inside the bash shell alias

> vim ~/.bash_profile

alias task='node /Users/my-path-to-download/to-do-cli

Once saved, open a new terminal session and any of the commands above can be ran from any directory with the alias

e.g.

> task new my task title