quicknote icon indicating copy to clipboard operation
quicknote copied to clipboard

UNIQUE constraint failed: books.name

Open hackmeister opened this issue 8 years ago • 3 comments

I just started getting this error from the following command: qnote edit book daily

hackmeister avatar Apr 22 '17 18:04 hackmeister

Appears I'm not checking if the book already exists

run qnote ls books to see if the book "daily" already exists, if so you can't have two books with the same name.

The edit book command is not well documented, the command changes the name of the current working book (default General) to the name given, in your case "daily". If you want to rename a different book. You need to give the -n flag with the book name.

So, if you want to rename a book called "hourly" to "daily" qnote edit book -n hourly daily

If you want to move all the notes from one book to another existing book. You need to use the merge command

$ qnote merge -h
Merge all of the notes from <book_name 1> into <book_name 2>. Than <book_name 1>
is deleted and <book_name 2> is re-indexed.

Usage:
  qnote merge [flags] <book_name 1> <book_name 2>

Global Flags:
  -n, --notebook string   Working Notebook (default "General")
      --skip-confirm      Do not prompt to confirm action

anmil avatar Apr 22 '17 19:04 anmil

The documentation does not really explain how to use a specific book. How do you use or post to a specific book? Keep up the good work, I think you have a great little app.

Thanks Jim

On Sat, Apr 22, 2017 at 3:43 PM, Andrew Miller [email protected] wrote:

Appears I'm not checking if the book already exists

run qnote ls books to see if the book "daily" already exists, if so you can't have two books with the same name.

The edit book command is not well documented, the command changes the name of the current working book (default General) to the name given, in your case "daily". If you want to rename a different book. You need to give the -n flag with the book name.

So, if you want to rename a book called "hourly" to "daily" qnote edit book -n hourly daily

If you want to move all the notes from one book to another existing book. You need to use the merge command

$ qnote merge -h Merge all of the notes from <book_name 1> into <book_name 2>. Than <book_name 1> is deleted and <book_name 2> is re-indexed.

Usage: qnote merge [flags] <book_name 1> <book_name 2>

Global Flags: -n, --notebook string Working Notebook (default "General") --skip-confirm Do not prompt to confirm action

https://github.com/anmil/quicknote/blob/master/cmd/ qnote/commands/edit_book.go#L44

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/anmil/quicknote/issues/9#issuecomment-296396785, or mute the thread https://github.com/notifications/unsubscribe-auth/AAg0w1vdBs-kYvtMjuVFSUCc-xSXONh0ks5rylhLgaJpZM4NFLLp .

-- Jim Richards 679 Chick Crossing Rd. Wells, ME 04090 813-323-8683

hackmeister avatar Apr 23 '17 11:04 hackmeister

The -n flag specifies the book, with "General" being the default

This command will create a new note in the "General" book qnote new note

This command will create a new note in the "Daily" book qnote new -n daily note

You can create new books with qnote new book <book name>

anmil avatar Apr 24 '17 02:04 anmil