Skip to content

MikyStar/CLI-Manager

Repository files navigation

npm version npm downloads Snyk Vulnerabilities for npm package npm license code climate maintainability

CLI Task Manager

Providing an easy and usefull Command Line Interface for managing tasks on the fly

Will store inside a local file your tasks in a simple JSON format so you can track their evolution using version control.

Use


Table of content


Installation

Requires NPM

# Install package

npm i -g cli-task-manager
# Or
pnpm add -g cli-task-manager
# Or
yarn add -g cli-task-manager

task --version # Print installed version
task --help # Print the manuel

Use

Init

task storage	# Will generate a task storage file 'tasks.json' under working directory
task storage ./tasks/v0.1.0.json	# Will generate a task storage file under specified location
task config	# Will generate the optional config file 'task.config.json' to pass default arguments to the CLI

Files

  • tasks.json or the name you want, a storage file
  • task.config.json, the configuration file, optional

The storage file

By default named tasks.json in your working directory, he stores your tasks and states

If your storage file is different than the default tasks.json, you either have to pass the storage argument for every CLI commands or use the storageFile attribute in the config file see []

Example:

task storage [<relative path>] # Create a task storage file, path optional
{
	"meta":
	{
		"states": [
			{
				"name": "todo",
				"hexColor": "#ff8f00",
				"icon": ""
			},
			{
				"name": "wip",
				"hexColor": "#ab47bc",
				"icon": ""
			},
			{
				"name": "to test",
				"hexColor": "#2196f3",
				"icon": ""
			},
			{
				"name": "done",
				"hexColor": "#66bb6a",
				"icon": ""
			}
		]
	},
	"datas":
	[
		{
			"name": "Add more stuff",
			"description": "There's a lot of things to do",
			"state": "todo",
			"id": 0,
		}
	]
}

states:

An ordered array of objects that defined task state progression

The config file

Optional file named task.config.json in your working directory, it defines the default argument to pass to the CLI.

Example:

task config # Create a task config file
{
	"hideDescription": true,
	"hideTree": true,
	"shouldNotPrintAfter": false,
	"hideCompleted": true,

	"depth" : 3,

	"storageFile": "./tasks/v0.1.0.json",
}

Check printing options for more options


Printing arguments

Can either be passed as CLI arguments or stored in the config file

CLI arg CLI 'bypass' arg Config file attribute Description
--storage <path> / "storageFile": "./path/storageFile.json" Which storage file to use, if not default
--depth <n> / "depth": n Reduce the child subtask level depth
--hide-description --show-description "hideDescription": true Hide tasks descriprion
--hide-completed --show-completed "hideCompleted": true Hide tasks which reached final state
--hide-tree / "hideTree": true Hide tree branches
--no-print --print "shouldNotPrintAfter": true Don't print task list after edition
--group <attribute> / "group": "state" Group by attribute (state, id, priority)
--sort <asc|desc> / "sort": "desc" Sort order
--clear --no-clear "clearBefore": false Clear before printing

Priority: CLI arg > CLI 'bypass' arg > Config file attribute


Commands

You can use the help flag if you want a quick reminder of the CLI commands

task --help # Full manuel
task a --help # Print help for adding task

# Adding tasks
task a	# Create a new task with interactive prompt
task a 'refactor logs'	# Create a task 'refactor logs'
task a 'better interface' '!!'	# Create 1 task 'better interface' with a priority of 2
task a 'long task' -d 'Some description'	# Create a task with a Description
task a 'a statefull task' -s 'to test'	# Create a task with the State 'to test'
task a 12 'first sub task'	# Add sub-task to the task n° 12

# View specific
task 9	# Print only what's in task n°9
task 9,13	# Print details on what's in task n°9 and 13

# Editing tasks
task e 9	# Edit taks attributes with interactive prompt
task e 9 'renaming the task' -s 'wip'	# Rename task n°9 and change its state
task e 9,7,2 -s 'to test'	# Change state to 'to test'
task c 7	# Put task to final state, 'Check'
task i 11,14	# Pass tasks 11 and 14 to next state, "Increment"
task i 11,14 -r	# Pass tasks 11 and 14 and their subtasks to next state, "Increment"

# Moving tasks
task mv 9,7,11 3	# Move multiple tasks and subtasks to task as subtasks (maintining tree structure)

# Deleting tasks
task d 9,7,11	# Delting tasks 9, 7 and 11

# Extracting to new file
task x 9,7,11 newFile.json	# Move tasks 9, 7 and 11 to a new storage file ./newFile.json

CLI commands are ment to help you manage your tasks quicker but you can manually edit them if you want !

Intended Workflow

Start by a simple task storage at the root of your project

Create and manage your tasks and subtasks with CLI or direct file edition

If you feel like you should break down your storage file as it become to crowded, cut out some of the tasks into a new storage file, and change the default storage path in your config file (task config)

Keep track of stuff you need to do using a VCS like Git

You may want to create a tasks folder where you could add a new storage file for every release with task storage ./tasks/v1.json, with version control, it could act as a changelog for instance

Using t as an alias is also simpler


Changelog

Check the tasks folder to see what has been done !

About

Providing an easy and usefull Command Line Interface for managing tasks locally on the fly

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published