-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathexample_test.go
42 lines (35 loc) · 1013 Bytes
/
example_test.go
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
33
34
35
36
37
38
39
40
41
42
//go:build !windows
// +build !windows
package notes_test
import (
"github.com/fatih/color"
"github.com/rhysd/notes-cli"
"os"
"path/filepath"
)
func Example() {
color.NoColor = true
cwd, err := os.Getwd()
if err != nil {
panic(err)
}
cfg := ¬es.Config{
HomePath: filepath.Join(cwd, "example", "notes-cli"),
}
cmd := notes.ListCmd{
Config: cfg,
Oneline: true,
Out: os.Stdout,
}
// Shows oneline notes (relative file path, category, tags, title)
if err := cmd.Do(); err != nil {
panic(err)
}
// Output:
// blog/daily/dialy-2018-11-20.md dialy-2018-11-20
// blog/daily/dialy-2018-11-18.md notes dialy-2018-11-18
// memo/tasks.md My tasks
// memo/notes-urls.md notes URLs for notes
// blog/tech/introduction-to-notes-command.md notes introduction-to-notes-command
// blog/tech/how-to-handle-files.md golang,file How to hanle files in Go
}