Fix: unable to use empty string as excerpt

This commit is contained in:
Radhi Fadlillah 2018-03-06 20:00:46 +07:00
parent 035e83746b
commit 9d3c8eedf9

View file

@ -32,7 +32,7 @@ var (
skipConfirmation, _ := cmd.Flags().GetBool("yes")
// Check if --url flag is used
if url != "" {
if cmd.Flags().Changed("url") {
if len(args) != 1 {
cError.Println("Update only accepts one index while using --url flag")
return
@ -45,6 +45,11 @@ var (
}
}
// Check if --excerpt flag is used
if !cmd.Flags().Changed("excerpt") {
excerpt = "|-|-|"
}
// If no arguments, confirm to user
if len(args) == 0 && !skipConfirmation {
confirmUpdate := ""
@ -153,7 +158,7 @@ func updateBookmarks(indices []string, url, title, excerpt string, tags []string
bookmarks[i].Title = title
}
if excerpt != "" {
if excerpt != "|-|-|" {
bookmarks[i].Excerpt = excerpt
}