package

github.com/kayobass/task-manager-cli

main / published May 11, 2025 / repository

With this application, you can add, remove, list, edit and mark tasks as completed or undone directly from your terminal.

๐Ÿ“ Task Manager Application

Welcome to the Task Manager! This is a command-line application built to help you manage your tasks effectively. With this app, you can add, remove, list, edit, and mark tasks as done or undone. ๐Ÿš€


๐ŸŒŸ Features

1. Add Task โž•

Add a new task to the list with a unique title:

  • The title is checked to prevent duplicates.
  • Maximum limit of 30 tasks in the list.

2. Remove Task(s) โŒ

Options available:

  • Remove a specific task by number.
  • Remove all tasks.
  • Remove all completed tasks.
  • Remove all pending tasks.
  • Remove multiple tasks using:
    • A range (e.g., 1-5).
    • A list (e.g., 1,3,5).

3. List Tasks ๐Ÿ“‹

Display all tasks with their status:

  • [ ] - Pending task.
  • [X] - Completed task.

4. Mark as Completed โœ…

Mark one or more tasks as completed:

  • Option to mark all tasks.
  • Multiple selection using ranges or lists.

5. Unmark as Completed ๐Ÿ”„

Unmark one or more completed tasks:

  • Option to unmark all completed tasks.
  • Multiple selection using ranges or lists.

6. Edit Task Title โœ๏ธ

Edit the title of an existing task:

  • If the task is not found, you will be asked whether to create a new one with the given title.

7. Sort Tasks ๐Ÿ”€

Reorder the task list:

  • Alphabetical (alp): Sort tasks alphabetically.
  • Creation Order (cri): Restore original creation order.

๐Ÿ› ๏ธ How to Use

1๏ธโƒฃ Clone the Repository

Run the script in your terminal:

   git clone https://github.com/balah7/task-manager-cli
   cd task-manager

2๏ธโƒฃ Start the Application

Run the script in your terminal:

shards run

2๏ธโƒฃ Menu Options

Once the application starts, you will see a menu like this:

 === Task Manager ===
 1. Add task
 2. Remove task (if tasks exist)
 3. List tasks (if tasks exist)
 4. Mark task as done (if tasks exist)
 5. Unmark task as done (if tasks exist)
 6. Edit task title (if tasks exist)
 7. Edit task order (if more than 1 task exists)
 0. Exit

๐Ÿ—‚๏ธ Menu Actions

  1. Add Task

    • Enter a title for your task. The app will ensure the title is unique and valid.
  2. Remove Task

    • Options for removing tasks:
      • 'all': Remove all tasks.
      • 'alld': Remove only completed tasks.
      • 'allud': Remove only unfinished tasks.
      • For multiple choices, use 'n,n,n' (1,2,3...) or 'n-n' (1-3)
      • Or provide a task number to remove a specific task.
  3. List Tasks

    • Displays all tasks with their completion status:
      • [X]: Completed
      • [ ]: Not completed
  4. Mark Task as Done

    • Options for marking tasks as done:
      • 'all': Mark all tasks as done.
      • For multiple choices, use 'n,n,n' (1,2,3...) or 'n-n' (1-3)
      • Enter the task number to mark a specific task.
  5. Unmark Task as Done

    • Options for unmarking tasks as done:
      • 'all': Unmark all tasks.
      • For multiple choices, use 'n,n,n' (1,2,3...) or 'n-n' (1-3)
      • Enter the task number to unmark a specific task.
  6. Edit Task Title

    • Update the title of any task. Provide the task number and the new title.
  7. Edit Task Order

    • Options for ordering tasks:
    • 'alp': Organize the to-do list alphabetically.
    • 'cri' (Standard): Organize the to-do list in order of date created
    • Enter the sort type to organize the tasks.
  8. Exit

    • Exit the Task Manager application.

โš™๏ธ Application Behavior

  • The app ensures task titles are unique, have a minimum of 3 characters, and don't exceed 152 characters.
  • Reserved titles like 'all', 'alld', and 'allud' cannot be used as task titles.
  • The app supports a maximum of 30 tasks.

๐Ÿ“‹ Example Usage

Adding a Task

Enter task title: Finish homework
Task 'Finish homework' added!

Listing Tasks

01. [ ] Finish homework
02. [X] Go shopping

Marking as Done

Enter the task number or the option to mark as done: 1
Task 'Finish homework' marked as done!

Removing Completed Tasks

Enter the task number or the option to remove: alld
All your completed tasks have been removed! (1)

๐Ÿ—๏ธ Code Structure

  • main.cr: The main file where the menu and interaction logic are defined.
  • task_manager.cr: Handles task logic, including adding, removing, listing, marking/unmarking, and sorting.
  • task.cr: Defines the Task class, representing a task with a title, status, and ID.

๐Ÿ’ป System Requirements

  • Crystal Language: Ensure Crystal is installed on your system.
    ใ…คInstallation guide: Crystal Lang
  • Interactive terminal environment.

๐ŸŽ‰ Enjoy!

Manage your tasks efficiently and never forget what needs to be done. Happy organizing! ๐ŸŽŠ (Application made only to test knowledge in Crystal language.)

Credits

  • ๐Ÿ’ก Code idea: ChatGPT
  • ๐Ÿฌ Developer and author: ~Balah7~

~333~

API

  • Task
  • TaskManager

    TO DO: Implementar multiplas escolhas em remove_task e testar o que for possivel fazer no cรณdigo e traduzir o cรณdigo e aplicar clean code e aplicar nivel de acesso na classe.