Making a TIME Management Tool for the CLI (part 9)
This is the 10th day of my participation in the August More Text Challenge. For details, see “August More Text Challenge”.
preface
The last article focused on the logic of automatically logging transactions
Through the introduction of the previous eight articles, this tool is now ready for initial use
This article will walk you through the use of the core functionality that has been developed
use
The installation
- You need Node installed on your computer
- If the dependency cannot be found, switch the NPM source to the official source
npm config set registry https://registry.npmjs.org/
Copy the code
The installation
npm install -g time-control
Copy the code
View the supported commands
After eight days of hard work, you can see that we have developed a lot of instructions. Here are a few core examples:
- Automatic recording
- Generate weekly/daily/monthly reports (time reports)
timec --help
Copy the code
Project initialization
Create a project for recording
timec init timeLog
Copy the code
Create a file
Create a file for automatic writing
timec create auto.md
Copy the code
The created template file will have some content that can be manually cleared
Setting the file path
Set the path for the automatic recording file
timec upPath ./auto.md
Copy the code
Task management
View ongoing tasks
timec task
Copy the code
Create a new task
timec task <name>
Copy the code
To switch tasks, use the same instructions and parameters as to create tasks
Choose to use this task if it already exists
timec task <name>
Copy the code
Example Delete an existing task
- add
-d
Option means remove the task
timec task -d <name>
Copy the code
Transaction management
Start a new transaction
timec thing <name>
Copy the code
View current ongoing transactions
timec thing
Copy the code
End the current transaction
- add
-s
Parameters can be - Ending a transaction automatically records the transaction that was just done to a file
timec thing -s
Copy the code
Start a new transaction without switching transactions
- End the process directly, and then write the result to a file
- Then start a new transaction
timec thing <name>
Copy the code
Note: The number of the transaction record is the time of the transaction in 5 decimal places in hours
This is the end of the demonstration of transaction-related operations
With the data from the transaction record, the next step is to generate the report
The user export function is described below
Diversification derivation
Export to JSON
Developers can use this json string to do their own personalized analysis
timec -oj <filepath>
Copy the code
Export the Markdown
Add the -t option to the md file to add detailed time, including transaction, task, and day dimensions
timec -omt <filepath>
Copy the code
Generate daily
Specify the date to view and the file to analyze:
- The generated report includes the total time of a day, the total time of a task
timec -or -D <date> <filepath>
Copy the code
Generate monthly report
Use -m to specify the month to view
timec -or -M <month> <filepath>
Copy the code
A period of time to report
You can use this to generate weekly reports, reports for any time range
timec -or -R <startTime_endTime> <filepath>
Copy the code
summary
The core functions are basically introduced in detail, and some bugs were found during the demonstration, which will be optimized in the next period
Data display this piece of the follow-up will also bring you a wealth of functions, inspiration is still there, only time
other
Because of the limited free time each day, this article will stop there
If you don’t have enough, stay tuned for updates, or keep an eye on the status of the warehouse
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