todo

package module
v0.0.0-...-c60b7ab Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 11, 2023 License: MIT Imports: 6 Imported by: 0

README


Todo App

A simple and efficient command-line Todo application, built in Go. This app allows users to manage their tasks effectively, with functionalities like adding, completing, and deleting tasks, along with a visually appealing display of todo items.

Features

  • Add tasks: Quickly add new tasks.
  • Complete tasks: Mark tasks as completed.
  • Delete tasks: Remove tasks from the list.
  • List tasks: Display all tasks with their status.
  • Visual Appeal: Uses colored text and table format for better readability.

Installation

To install the Todo app, you need to have Go installed on your machine. Follow these steps:

  1. Clone the repository:
    git clone https://github.com/stevel705/todo-app.git
    
  2. Navigate to the cloned directory:
    cd todo-app
    

Usage

After installation, you can run the app using the following commands:

  • Adding a task:
    go run cmd/todo/main.go -add "Your task here"
    
  • Completing a task:
    go run cmd/todo/main.go -complete [task number]
    
  • Deleting a task:
    go run cmd/todo/main.go -del [task number]
    
  • Listing all tasks:
    go run cmd/todo/main.go -list
    

Structure

The application's structure is as follows:

├── LICENSE
├── Makefile
├── README.md
├── cmd
│   └── todo
│       └── main.go
├── colors.go
├── go.mod
├── go.sum
├── todo.go
└── todos.json
  • main.go: The entry point of the application, handling command-line arguments and user interaction.
  • todo.go: Contains the core functionalities and structures of the Todo application.
  • colors.go: Provides functions for colored text output to enhance the UI.
  • todos.json: Stores the todo items in a JSON format.
  • Makefile: Contains commands for building and running the application.

Example

╔═══╤═══════════════════════════════╤═══════╤═════════════════════╤═════════════════════╗
║ # │             Task              │ Done? │           CreatedAt │         CompletedAt ║
╟━━━┼━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┼━━━━━━━┼━━━━━━━━━━━━━━━━━━━━━┼━━━━━━━━━━━━━━━━━━━━━╢
║ 1 │ ✅ Create todo app on golang  │ yes   │ 09 Dec 23 21:21 +04 │ 11 Dec 23 22:38 +04 ║
║ 2 │ ✅ write readme               │ yes   │ 09 Dec 23 21:24 +04 │ 11 Dec 23 22:38 +04 ║
║ 3 │ another task                  │ no    │ 11 Dec 23 22:29 +04 │ 01 Jan 01 00:00 UTC ║
║ 4 │ another task from pipe        │ no    │ 11 Dec 23 22:30 +04 │ 01 Jan 01 00:00 UTC ║
╟━━━┼━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┼━━━━━━━┼━━━━━━━━━━━━━━━━━━━━━┼━━━━━━━━━━━━━━━━━━━━━╢
║                               You have 2 pending todos                                ║
╚═══╧═══════════════════════════════╧═══════╧═════════════════════╧═════════════════════╝

Contributing

Contributions to improve the application are welcome. Feel free to fork the repository and submit pull requests.

License

Distributed under the MIT License. See LICENSE for more information.


You can adjust the content as per your project's specifics and any additional features or instructions you might want to add.

Documentation

Index

Constants

View Source
const (
	ColorDefault = "\x1b[39m"

	ColorRed   = "\x1b[91m"
	ColorGreen = "\x1b[32m"
	ColorBlue  = "\x1b[94m"
	ColorGray  = "\x1b[90m"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Todos

type Todos []item

func (*Todos) Add

func (t *Todos) Add(task string)

func (*Todos) Complete

func (t *Todos) Complete(index int) error

func (*Todos) CountPending

func (t *Todos) CountPending() int

func (*Todos) Delete

func (t *Todos) Delete(index int) error

func (*Todos) Load

func (t *Todos) Load(filename string) error

func (*Todos) Print

func (t *Todos) Print()

func (*Todos) Store

func (t *Todos) Store(filename string) error

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL