mirror of
https://github.com/dnote/dnote
synced 2026-03-14 22:45:50 +01:00
Fix output of multi-line notes (#89)
* Make output more condensed * Fix broken output when adding notes with multiple lines * 0.3.1
This commit is contained in:
parent
215685bf6e
commit
021173e1d9
3 changed files with 10 additions and 3 deletions
|
|
@ -1,6 +1,7 @@
|
|||
package add
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/dnote-io/cli/core"
|
||||
|
|
@ -66,8 +67,10 @@ func newRun(ctx infra.DnoteCtx) core.RunEFunc {
|
|||
return errors.Wrap(err, "Failed to write note")
|
||||
}
|
||||
|
||||
log.Printf("note: \"%s\"\n", content)
|
||||
log.Successf("added to %s\n", bookName)
|
||||
fmt.Printf("\n------------------------content------------------------\n")
|
||||
fmt.Printf("%s", content)
|
||||
fmt.Printf("\n-------------------------------------------------------\n")
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,7 +54,6 @@ func newRun(ctx infra.DnoteCtx) core.RunEFunc {
|
|||
book := dnote[bookName]
|
||||
note := book.Notes[noteIdx]
|
||||
|
||||
log.Plain("\n")
|
||||
log.Infof("book name: %s\n", bookName)
|
||||
log.Infof("note uuid: %s\n", note.UUID)
|
||||
log.Infof("created at: %s\n", time.Unix(note.AddedOn, 0).Format("Jan 2, 2006 3:04pm (MST)"))
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ import (
|
|||
|
||||
const (
|
||||
// Version is the current version of dnote
|
||||
Version = "0.3.0"
|
||||
Version = "0.3.1"
|
||||
|
||||
// TimestampFilename is the name of the file containing upgrade info
|
||||
TimestampFilename = "timestamps"
|
||||
|
|
@ -494,6 +494,11 @@ func SanitizeContent(s string) string {
|
|||
|
||||
ret = strings.Trim(s, " ")
|
||||
|
||||
// Remove newline at the end of the file because POSIX defines a line as
|
||||
// characters followed by a newline
|
||||
ret = strings.TrimSuffix(ret, "\n")
|
||||
ret = strings.TrimSuffix(ret, "\r\n")
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue