gops

package module
v1.0.17 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2023 License: MIT Imports: 8 Imported by: 0

README

gops

The most simple terminal todo utility in the World.

  • Simple
  • Stupid
  • Concrete

Smart-ID in Go language

What? Why?

Around the World, there are tons of todo-like software. Why do we need to make another? Because I desperately need a simple, convenient to-do list in terminal. The software should be as simple as possible and usable with only a few keystrokes.

gops?

The name gops is ambiguous:

  1. gops might mean 'go-operations' aka 'go-todolist'.
  2. gops might be Gopink, which I like more 😀.

Install

A command tool gops will be built into $GOPATH/bin/.

go install github.com/dknight/gops/...

CLI usage

Usage of gops:
  -c uint
        Number of the task to complete.
  -f string
        File of stored todo items. (default /home/xdkn1ght/.config/gops/default)
  -l    Display todo-lists.
  -n string
        Set name of the new todo task.
  -s    Sort items by date and status.
  -t    Set list to today's date.
  -u    Display only incomplete items.
  -v    Displays the version.
Make a new item
gops -n "Make a soup"
gops -n "Drink beer and eat semki"
Complete an item
gops -c 2
List all items completed and incompleted
gops -a
Some cli usage examples

Use different list rather than default.

gops -n "Make training at gym" -f training
gops -n "Buy healthy food" -f lifestyle

gops -f lifestyle

Save and read to file with today's date.

gops -t -n "Today go to dentist"
gops -t

Testing

go test

Contribution

Any help is appreciated. Found a bug, typo, inaccuracy, etc.? Please do not hesitate to make a pull request or file an issue.

License

MIT 2022

Documentation

Index

Constants

View Source
const (
	// ItemStatusCompleted identifies item as done.
	ItemStatusCompleted = true
	// ItemStatusIncompleted identifies item as incomplete..
	ItemStatusIncompleted = false
)

Variables

View Source
var Color = struct {
	Blue   string
	Green  string
	Yellow string
	Red    string
	Nul    string
}{
	Blue:   "\033[94m",
	Green:  "\033[92m",
	Yellow: "\033[93m",
	Red:    "\033[91m",
	Nul:    "\033[0m",
}

Color contains some colors for terminal representation.

Functions

func ConfigDir added in v1.0.8

func ConfigDir() string

ConfigDir gets the gops name in config directory.

func CreateStoreFile added in v1.0.8

func CreateStoreFile() (*os.File, error)

CreateStoreFile create store file if not exists.

func DefaultFile added in v1.0.8

func DefaultFile() string

DefaultFile gets default file name in config directory.

func DisplayLists

func DisplayLists(rds []io.Reader) error

DisplayLists shows all lists.

func GetDefaultStoreFilePath added in v1.0.8

func GetDefaultStoreFilePath() string

GetDefaultStoreFilePath gets default file to store items.

func GetListsByPath added in v1.0.8

func GetListsByPath(path string) ([]io.Reader, error)

GetListsByPath gets all list by given path in file system.

func GetStoreFile added in v1.0.8

func GetStoreFile() (*os.File, error)

GetStoreFile resolves the file to store todo items on file system.

func GetSystemConfigPath added in v1.0.12

func GetSystemConfigPath() string

GetSystemConfigPath gets config directory, on Linux usually $HOME/.config

func MakeStoreFilePath added in v1.0.8

func MakeStoreFilePath(name string) string

MakeStoreFilePath makes path to store file.

func ResolveDoneColor added in v1.0.10

func ResolveDoneColor(st bool) string

ResolveDoneColor gets the done item color.

func SetStoreFileName added in v1.0.8

func SetStoreFileName(name string)

SetStoreFileName set store file name where items are written.

func SortItems added in v1.0.10

func SortItems(items []Item, wr io.Writer) error

SortItems sorts the items by date and the by status, completed items are going to bottom.

func StoreFileName added in v1.0.8

func StoreFileName() string

StoreFileName gets the file name where items are written.

func Truncate added in v1.0.10

func Truncate(wr io.Writer) error

Truncate truncates writer, currently implemeted only for file and buffer.

func Version

func Version() string

Version gets the version of gops. Maybe do better structure major, minor, patch.

Types

type Item

type Item struct {
	Time   time.Time
	Status bool
	Task   string
}

Item represents a todo item.

func AllItems

func AllItems(rd io.Reader) ([]Item, error)

AllItems reads the todo items from file and returns them.

func CompleteItem

func CompleteItem(i uint, items []Item, wr io.Writer) (*Item, error)

CompleteItem sets the status of a todo item to complete and writes it to file.

func FilterItemsByStatus

func FilterItemsByStatus(items []Item, status bool) []Item

FilterItemsByStatus filters the todo items by status completed or incomplete.

func NewItem

func NewItem(tm time.Time, s bool, t string) *Item

NewItem create a new todo item.

func (*Item) BeautifulString

func (item *Item) BeautifulString(i int) string

BeautifulString returns string to output with colors.

func (*Item) Complete

func (item *Item) Complete()

Complete completes a todo item.

func (*Item) GetMark added in v1.0.12

func (item *Item) GetMark() []rune

GetMark gets mark for completed or incompleted item.

func (*Item) Save

func (item *Item) Save(wr io.Writer) error

Save saves the todo item to file.

func (*Item) Slice

func (item *Item) Slice() []string

Slice converts the todo item into slice.

type List

type List struct {
	// Done counts completed items.
	Done int
	// Total counts total items.
	Total int
	// Name is the name of the list (file).
	Name string
}

List represents lists.

func (List) BeautifulString

func (li List) BeautifulString() string

BeautifulString prints list as the beautiful string.

Directories

Path Synopsis
cmd
gops
Command Line Interface (CLI) for gops.
Command Line Interface (CLI) for gops.

Jump to

Keyboard shortcuts

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