Skip to content

Commit

Permalink
Create note if it doesn’t exist yet when opening
Browse files Browse the repository at this point in the history
  • Loading branch information
bittersweet committed Dec 12, 2014
1 parent 03c8da3 commit f7cfdcb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Notes Changelog

## 0.4.0

- Opens editor with note name anyway if it doesn't exist yet.

## 0.3.0

- Colorize commented lines.
Expand Down
5 changes: 3 additions & 2 deletions notes.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ func showNote(note string) {
path := fmt.Sprintf("%v%v.txt", getHomeDir(), note)
file, err := os.Open(path)
if err != nil {
fmt.Printf("%v\n", err)
// File does not exist, creating it
editOrCreateNote(note)
}
defer file.Close()

Expand Down Expand Up @@ -79,7 +80,7 @@ func getHomeDir() string {
func main() {
app := cli.NewApp()
app.Name = "notes"
app.Version = "0.3.0"
app.Version = "0.4.0"
app.Usage = "Store your thoughts on all sorts of subjects"
app.Action = func(c *cli.Context) {
note := c.Args().First()
Expand Down

0 comments on commit f7cfdcb

Please sign in to comment.