todo

package module
v0.0.0-...-907442c Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2024 License: MIT Imports: 14 Imported by: 0

README

TODO

A todo list management system leveraging the nostr protocol.

Setup

Create a config file at ~/.config/nostr/todo.json

{
    "relays": ["wss://relay.damus.io/"],
    "nsec": "nsec..."
}

Add environment variable to point to configuration

export NOSTR_TODO=$HOME/.config/nostr/todo.json

Build the binay

make build

Usage

> todo add food Steak
Creating new list: food

> todo add food Butter

> todo list food
b1f19350-86d9-4caa-8989-660dcd98df55 (2024-02-05): [ ] Steak
57de7e02-8a1e-4d38-bd6e-53b28ed6e876 (2024-02-05): [ ] Butter

> todo done food b1f19350-86d9-4caa-8989-660dcd98df55

> todo list food
b1f19350-86d9-4caa-8989-660dcd98df55 (2024-02-05): [X] Steak
57de7e02-8a1e-4d38-bd6e-53b28ed6e876 (2024-02-05): [ ] Butter

> todo done food b1f19350-86d9-4caa-8989-660dcd98df55

> todo list food
b1f19350-86d9-4caa-8989-660dcd98df55 (2024-02-05): [ ] Steak
57de7e02-8a1e-4d38-bd6e-53b28ed6e876 (2024-02-05): [ ] Butter

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CONFIG = StringEnv("NOSTR_TODO")
View Source
var ErrNotFound = errors.New("todo list not found")

Functions

func Add

func Add(ctx context.Context, cfg *Config, name, content string) error

func Delete

func Delete(ctx context.Context, cfg *Config, id, name string) error

func Done

func Done(ctx context.Context, cfg *Config, name, id string) error

func List

func List(ctx context.Context, cfg *Config, name string) error

func StringEnv

func StringEnv(key string) string

func Undone

func Undone(ctx context.Context, cfg *Config, name, id string) error

Types

type Config

type Config struct {
	Nsec   string   `json:"nsec"`
	Relays []string `json:"relays"`
}

type Todo

type Todo struct {
	Id        string `json:"id"`
	Content   string `json:"content"`
	Done      bool   `json:"done"`
	CreatedAt int64  `json:"created_at"`
}

type TodoList

type TodoList []Todo

func (*TodoList) Load

func (tl *TodoList) Load(ctx context.Context, cfg *Config, name string) error

func (*TodoList) MarshalJSON

func (tl *TodoList) MarshalJSON() ([]byte, error)

func (*TodoList) Save

func (tl *TodoList) Save(ctx context.Context, cfg *Config, name string) error

func (*TodoList) Sort

func (tl *TodoList) Sort()

func (*TodoList) UnmarshalJSON

func (tl *TodoList) UnmarshalJSON(b []byte) error

Jump to

Keyboard shortcuts

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