The github link https://github.com/yuyan-z/Codecamp-Project/tree/main
argparse, datetime, os
Command | Description |
---|---|
task <file_name> add <description> |
Add a task in the task file, given description and other attributes |
task <file_name> modify <id> <--attribute> <value> |
Modify the task with the given id and the given attributes |
task <file_name> rm <id> |
Remove the task with the given id |
task <file_name> show |
Show tasks in tabular form |
task <file_name> find <--attribute> <value> |
Find the task with the given attributes |
task -h |
Get help |
Get arguments from the input command string command
, given the configuration config
.
Return a dict
args_dict
with the format of {arg_name: arg_value}
Author: EL BEZ Oumayma, HENI Yahia, LOBATO Felipe, ZHAO Yuyan
Read and run the command, given args_dict
and the configuration config
Author: EL BEZ Oumayma, HENI Yahia, LOBATO Felipe, ZHAO Yuyan
Initial the object's attributes, including self.file_name
the file name to store the tasks data, self.fields
the fields for the task, self.tasks
the list to store the tasks data, cols_max_len
the maximum length of each column
First read tasks data from task file self.file_name
. If it does not exist then create one.
Next, run the operation function. Finally save a history file
Add a task in the task file self.file_name
, given description and other attributes
Modify the task with the given id and the given attributes
Remove the task with the given id
Show tasks in tabular form
Find the task with the given attributes
Manage log file.
Author: LOBATO Felipe, ZHAO Yuyan
First read the log file from the given log file path, if it does not exist then create one.
Add a new log string at the end of log file after doing a command, with the format of '%Y/%m/%d %H:%M:%S_action'
The configuration can be modified in class Config
, including the attributes of task self.sub_attrs
, the range of choice self.choices
and help text for attributes self.helps
Author: ZHAO Yuyan
Display the list data
in tabular form, given a list of header fields heads
and the maximum length of each column cols_max_len
.
Author: ZHAO Yuyan
Convert the input variable attr
to string type. The type of attr
can be str
, int
, or list
.
Author: ZHAO Yuyan
-
Run main.py
-
First time add a task in the task file
lestaches.txt
with the descriptiongroup meeting 1
task lestaches.txt add group meeting 1
Set values for other parameters according to the help text
- Similarly, add other tasks. The result is as follows.
-
Modify the task with the given id
2
and the given parameters--state completed --actual_duration 1h
task lestaches.txt modify 2 --state completed --actual_duration 1h
-
Remove the task with the given id
3
(lunch). The id of the following rest tasks is decreased by one automaticallytask lestaches.txt rm 3
-
Find the task with the given parameters
--context classroom --tag dcl
task lestaches.txt find --context classroom --tag dcl
- We can see that, after each operation, a log string is generated in
log.txt
, and a history file is generated in.\history\