Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Cmd = &Z.Cmd{ Name: `note`, Summary: `taking quick notes`, Version: `v0.0.1`, Commands: []*Z.Cmd{help.Cmd, conf.Cmd, List, New, Edit, Remove, Latest, Push}, }
View Source
var Edit = &Z.Cmd{ Name: `edit`, Aliases: []string{"e", "ed"}, Usage: `<id>`, Summary: `open a specific note in your editor`, Commands: []*Z.Cmd{help.Cmd}, Call: func(_ *Z.Cmd, args ...string) error { n, err := note.Latest() if len(args) != 0 { n, err = note.GetById(args[0]) } if err != nil { return err } n.Edit() if yesOrNo("Commit?") { n, err = note.GetById(n.Id) Z.Exec("git", "add", n.Id) Z.Exec("git", "commit", "-m", n.Title) Z.Exec("git", "push") } return nil }, }
View Source
var Latest = &Z.Cmd{ Name: `latest`, Aliases: []string{"last"}, Summary: `prints latest note`, Commands: []*Z.Cmd{help.Cmd}, Call: func(_ *Z.Cmd, args ...string) error { n, err := note.Latest() if err != nil { return err } n.Print() return nil }, }
View Source
var List = &Z.Cmd{ Name: `list`, Aliases: []string{"ls"}, Summary: `list all valid notes in the current directory`, Commands: []*Z.Cmd{help.Cmd}, Call: func(_ *Z.Cmd, _ ...string) error { list, err := note.List() if err != nil { return err } for _, v := range list { v.Print() } return nil }, }
View Source
var New = &Z.Cmd{ Name: `new`, Aliases: []string{"add"}, Summary: `add a new note to the current directory`, Usage: `[title]`, Commands: []*Z.Cmd{help.Cmd}, Call: func(_ *Z.Cmd, args ...string) error { title := "Title's note" if len(args) != 0 { title = strings.Join(args, " ") } n, err := note.New(title) if err != nil { return err } n.Init() n.Edit() if yesOrNo("Commit?") { n, err = note.GetById(n.Id) Z.Exec("git", "add", n.Id) Z.Exec("git", "commit", "-m", n.Title) Z.Exec("git", "push") } return nil }, }
View Source
var Push = &Z.Cmd{ Name: `push`, Usage: `<id>`, Aliases: []string{"commit"}, Summary: `commit and push to git`, Commands: []*Z.Cmd{help.Cmd}, Call: func(_ *Z.Cmd, args ...string) error { n, err := note.Latest() if len(args) != 0 { n, err = note.GetById(args[0]) } if err != nil { return err } Z.Exec("git", "add", n.Path) Z.Exec("git", "commit", "-m", n.Title) Z.Exec("git", "push") return nil }, }
View Source
var Remove = &Z.Cmd{ Name: `remove`, Aliases: []string{"rm"}, Usage: `<id>`, Summary: `remove a specific note`, Commands: []*Z.Cmd{help.Cmd}, Call: func(_ *Z.Cmd, args ...string) error { n, err := note.Latest() if len(args) != 0 { n, err = note.GetById(args[0]) } if err != nil { return err } n.Print() if yesOrNo("Are you sure you want to remove this note?") { err := n.Remove() if err != nil { return err } Z.Exec("git", "add", n.Id) Z.Exec("git", "commit", "-m", "`Removed` "+n.Title) Z.Exec("git", "push") } return nil }, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.