Skip to content

Allows a user to manipulate a todo list from the command line. Tasks are stored on the system in the file "tasks.txt' and in the program as a slice. User can add a task, delete a task, or clear the task list.

Notifications You must be signed in to change notification settings

AdamZieman/todo-list-manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 

Repository files navigation

To-Do List Manager

This program allows a user to manage a todo list from the command line. Users can add a tasks, delete a task, clear all tasks, and exit the program. Tasks are stored on the system in the file "tasks.txt" and in the program as a slice. User input is read using bufio and manipulates the task list using a switch statement. The Task type is a struct with an ID and name. The program outputs the current task list and available commands to the user.

Prerequisites

To run this program, you will need Go installed on your system. You can download it from:

golang.org

Installation

  • Clone the repository.
  • (Optional) In the terminal, traverse to the project directory.
  • Run the following command: go run todolist.go.
    • If terminal's working directory is not the project directory, replace filename 'todolist.go' with file path.

How It Works

Upon running the program, the user will be presented with the current task list (or an empty task list, if the task list is empty) and the available options. To select an option, the user should enter the corresponding number and return. The program will then execute the selected option and loop back to the beginning.

OptionsMenu_EmptyList

Adding a Task

To add a new task to the list, select option 1 and enter a task description when prompted.

  • Does not add task to the list if an empty task description is entered.
  • Attempts to overwrite "tasks.txt" with an updated task list.

AddingTask

Deleting a Task

To delete a task from the list, select option 2 and enter the task ID when prompted.

  • Checks if there are any tasks to delete.
  • Iterates over the task list to check if the task ID exists.
    • If it exists, remove the task from the list and reorder the task ID.
  • If successful, attempt to overwrite "tasks.txt" file with an updated task list.

DeletingTask

Clearing the Task List

To clear all tasks from the list, select option 3.

  • Attempts to overwrite "task.txt" file with an empty task list.

ClearingTaskList

Exiting the Program

To exit the program, select option 4.

ExitingProgram

About

Allows a user to manipulate a todo list from the command line. Tasks are stored on the system in the file "tasks.txt' and in the program as a slice. User can add a task, delete a task, or clear the task list.

Topics

Resources

Stars

Watchers

Forks

Languages