Skip to content

Commit f7cfdcb

Browse files
committed
Create note if it doesn’t exist yet when opening
1 parent 03c8da3 commit f7cfdcb

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

Changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Notes Changelog
22

3+
## 0.4.0
4+
5+
- Opens editor with note name anyway if it doesn't exist yet.
6+
37
## 0.3.0
48

59
- Colorize commented lines.

notes.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ func showNote(note string) {
2929
path := fmt.Sprintf("%v%v.txt", getHomeDir(), note)
3030
file, err := os.Open(path)
3131
if err != nil {
32-
fmt.Printf("%v\n", err)
32+
// File does not exist, creating it
33+
editOrCreateNote(note)
3334
}
3435
defer file.Close()
3536

@@ -79,7 +80,7 @@ func getHomeDir() string {
7980
func main() {
8081
app := cli.NewApp()
8182
app.Name = "notes"
82-
app.Version = "0.3.0"
83+
app.Version = "0.4.0"
8384
app.Usage = "Store your thoughts on all sorts of subjects"
8485
app.Action = func(c *cli.Context) {
8586
note := c.Args().First()

0 commit comments

Comments
 (0)