Making a TIME Management Tool for the CLI (part 1)
background
Time management has always been a headache
I have used many graphical time management /TODO tools
None of them are very satisfying and irreplaceable
The simple operation process of common graphical software (desktop terminal/mobile terminal) is as follows:
- Open the software (one click to operate)
- Function selection (one-click operation)
- Locate the target function
- Select Add/Delete/Edit
- An output
- save
It feels a little tedious
At present, the pain points are also obvious, most of which are in the form of statistical TODO:
- A TODO can be done on and off, many times over many days
- There will be multiple tasks at a time, and there will be interruptions at any time
- Using timing tools, it is inevitable to forget the timing, so that the specific time of each task can not be more accurate statistics
- The weekly/monthly reports need to output technology/service/other time consuming. In this case, you need to manually collect statistics
- The short time is good
- Long talk takes a lot of effort
- . There are a few others that I won’t go into here
plan
Coder in addition to graphical editors used more, the next should be the terminal tools
Generally open the terminal tools are shortcut keys
Imagine that through a simple instruction can complete time statistics, time record, visual data generation, TODO record, weekly/monthly/daily report generation…. more
expect
Add a TODO
timec add <taskName>
Copy the code
Complete the TODO
timec fin <taskName>
Copy the code
Start the TODO
timec start <taskName>
Copy the code
suspended
timec pause <taskName>
Copy the code
. There are a lot of ideas and instructions, only the time, here no longer repeat, make and then share with everyone
starts
The preparatory work
Initialize the project
mkdir timec
cd timec
npm init -y
Copy the code
Install dependencies on commander
yarn add commander
Copy the code
Modify the package.json content to add the contents of the bin section
{
"name": "time-control"."version": "0.0.0"."description": "Generate your own Time Management Reports."."main": "index.js"."directories": {
"test": "test"
},
"bin": {
"timec": "./bin/index.js"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",},"repository": {
"type": "git"."url": "git+https://github.com/ATQQ/time-control.git"
},
"keywords": []."author": ""."license": "ISC"."bugs": {
"url": "https://github.com/ATQQ/time-control/issues"
},
"homepage": "https://github.com/ATQQ/time-control#readme"."dependencies": {
"commander": "^ 6.2.1." "}}Copy the code
Create the./bin/index.js file and type the demo content
#! /usr/bin/env node
console.log('hello world');
Copy the code
Run the demo
npm link
# to perform
timec
Copy the code
The output
Preliminary path
Organize the content in the form of MD documents
The MD content is parsed into a JSON object through a script
The final statistics, the reports, are in hand
Markdown format
# 2021-08-01
# # 1
*A component of 0.2*The component b 0.3Task # # 2
*Familiarity with Code 0.1*Learn xx using 0.2# # other
*Learning Vue 0.1*0.1 write notes# 2021-08-02
# # 1
*A component of 0.2*The component b 0.3Task # # 2
*Familiarity with Code 0.1*Learn xx using 0.2# # other
*Learning Vue 0.1*0.1 write notesCopy the code
- Level 1 title setting time
- The headset title identifies the task
- The rest is to describe specific tasks and times
- The time used here is not fixed units, by the user’s own definition
- It can be hours/minutes/even fractions of a day
- The time used here is not fixed units, by the user’s own definition
The resulting JSON structure is as follows
[{"title": "2020-12-23"."tasks": [{"title": "Task 1"."things": [{"time": "0.2"."content": "A component"
},
{
"time": "0.3"."content": Component "b"}]}, {"title": Task 2 ""."things": [{"time": "0.1"."content": "Know the code"
},
{
"time": "0.2"."content": "Learning to use XX"}]}, {"title": "Other"."things": [{"time": "0.1"."content": "Learning Vue"
},
{
"time": "0.1"."content": "Write notes"}]}]}]Copy the code
With this JSON structure we can do whatever we want
other
Because of the limited free time each day, this article will stop there
If you still feel more than enough, please stay tuned for further updates, or check out the warehouse first
Welcome to comment section to raise demand, exchange discussion
This series will continue to be updated and iterated until the first generation of the product is completed
- The warehouse address