blob: 5ae2e438f977dbd285447080f85ee534f5243337 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
package main
import (
"fmt"
"os"
"strings"
"github.com/gammons/todolist/todolist"
)
func main() {
if len(os.Args) <= 1 {
usage()
os.Exit(0)
}
input := strings.Join(os.Args[1:], " ")
routeInput(os.Args[1], input)
}
func usage() {
fmt.Println("usage")
}
func routeInput(command string, input string) {
app := todolist.NewApp()
switch {
case command == "l" || command == "list":
app.ListTodos(input)
case command == "a" || command == "add":
app.AddTodo(input)
}
}
|