Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Console = func(c *cli.Context) error { completions = append( completions, readline.PcItem("help"), readline.PcItem("exit"), readline.PcItem("quit"), ) completer := readline.NewPrefixCompleter(completions...) shellwords.ParseEnv = true shellwords.ParseBacktick = true l, err := readline.NewEx(&readline.Config{ Prompt: "\033[35mcalends \033[36m» \033[0m", HistoryFile: "", AutoComplete: completer, InterruptPrompt: "^C", EOFPrompt: "exit", HistorySearchFold: true, }) if err != nil { panic(err) } defer l.Close() printf = func(message string, args ...interface{}) { io.WriteString(l.Stdout(), fmt.Sprintf(message, args...)) } log.SetOutput(l.Stderr()) for { line, err := l.Readline() if err == readline.ErrInterrupt { if len(line) == 0 { break } else { continue } } else if err == io.EOF { break } line = strings.TrimSpace(line) if line == "" || line == "help" { printf("commands:\n") printf(completer.Tree(" ")) continue } else if line == "quit" || line == "exit" { break } args, err := shellwords.Parse(line) if err != nil { log.Printf("%v\n", err) } else if cmd, ok := commands[args[0]]; ok { err = cmd(args[1:]) if err != nil { log.Printf("%v\n", err) } } else { log.Printf("unknown command %q\n", args[0]) } } return nil }
Main logic
Functions ¶
This section is empty.
Types ¶
This section is empty.
Source Files ¶
- abuts.go
- add-from-end.go
- add.go
- compare.go
- contains.go
- core.go
- date.go
- difference.go
- end-date.go
- ends-after.go
- ends-before.go
- ends-during.go
- gap.go
- intersect.go
- is-after.go
- is-before.go
- is-during.go
- is-longer.go
- is-same-duration.go
- is-same.go
- is-shorter.go
- merge.go
- next.go
- overlaps.go
- parse-range.go
- parse.go
- previous.go
- set-date.go
- set-end-date.go
- starts-after.go
- starts-before.go
- starts-during.go
- subtract-from-end.go
- subtract.go
Click to show internal directories.
Click to hide internal directories.