ObjectiveΒΆ
The focus for week 1 is a Command-Line Interface (CLI) for a task list in the GO Language.
ResearchΒΆ
RequirementsΒΆ
FunctionalΒΆ
- The User must be able to view all tasks.
- The User must be able to add a new task.
-
The User must be able to remove an existing task.
-
The Program must be able to access the task file, for persistent storage.
Non-FunctionalΒΆ
- The User wants an easily human-readable output.
- The User wants to add a task description for additional information on the task needing to be completed.
MoSCoWΒΆ
- Must be able to view all tasks.
- Must be able to add a new task.
- Must be able to remove an existing task.
- Must be able to persist tasks across program restart.
-
Must have a unique identifier (
incremental int ID) for every task. -
Should have a Task Description for more information.
-
Could be listed alphabetically.
- Could have minimal error handling e.g. no existing, or duplicate.
-
Could have no stack traces. Clean human-readable outputs
-
Won't be able to add or remove tasks with from an interactive CLI menu, only as command-line arguments.
Required LibrariesΒΆ
os- For File Handling (Reading/Writing).slices- For Arrays and Alpha Sorting.testing- For Program Unit Testing.encoding/json- for JSON parsing.
DesignΒΆ
CommandsΒΆ
tasklist all - list all tasks.
tasklist add <TASK_NAME> [DESCRIPTION] - add new task.
tasklist remove <TASK_ID> - remove existing task.
Note
# represents a unique identifier.
<> must have included.
[] optional
Tasklist AllΒΆ
---
title: All Tasks
---
flowchart LR
u(( )) --> v
v{Is Tasks List Empty?}
v -->|Yes| r1[No Tasks Added]
v -->|No| r2[Show Tasks]
r1 & r2 --> e(( )) $ tasklist all
|--------------------|
| TASKLIST MANAGER |
|--------------------|
| #. Task One! |
| #. Task Two! |
| #. Task Three! |
|--------------------|
Tasklist AddΒΆ
---
title: Add Task
---
flowchart LR
u(( )) --> t[/Task Input/] --> v
v{Is Task a Duplicate?}
v -->|Yes| r1[Task Already Exists]
v -->|No| r2[Added New Task #]
r1 & r2 --> e(( )) $ tasklist add <TASK_NAME> [TASK_DESCRIPTION]
IF DUP
|------------------|
| TASKLIST MANAGER |
|------------------|
| Task Exists - # |
|------------------|
ELSE
|------------------|
| TASKLIST MANAGER |
|------------------|
| Task Added - # |
|------------------|
Tasklist RemoveΒΆ
---
title: Remove Task
---
flowchart LR
u(( )) --> t[/Task ID Input/] --> v
v{Does Task Exist?}
v -->|Yes| r1[Task # Deleted]
v -->|No| r2[No Task Exists]
r1 & r2 --> e(( )) Note
Potentially have an alias: delete
$ tasklist remove <TASK_ID>
IF NONE
|------------------|
| TASKLIST MANAGER |
|------------------|
| No Task Found! |
|------------------|
ELSE
|------------------|
| TASKLIST MANAGER |
|------------------|
| Task Deleted |
|------------------|
Note
Potentially have an alias: tasklist remove --list
Important
- Main - Command-Line Arguments ONLY.
- Tasks - Handles the Struct, and Slice, File Handling and JSON Un/Marshaling.