quicknote

package module
v0.0.0-...-a0a41b1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 25, 2017 License: GPL-3.0 Imports: 4 Imported by: 0

README

Swift Note Taker and Searcher

Qnote is a lightweight, easy-to-use tool for managing and finding quick notes.

Key Features:

  • Organize notes into collections (Books)
  • Create notes with your preferred editor (default: Vim)
  • Generate notes from web pages
  • Tag notes with hashtags
  • Edit and delete notes
  • Search with Bleve or Elasticsearch
  • Export notes to various formats (colored text, CSV, JSON)
  • Manage collections (delete, merge, split)
  • No configuration needed, just install and go
  • Compatible with Linux and macOS
  • Experimental CUI interface

Getting Started:

  1. Install Go: If you haven't already, install Go from here.

  2. Install Qnote: Use the following command:

    go get github.com/anmil/quicknote/cmd/qnote 
    

Managing Collections (Books):

  • Create a new collection:

    qnote new book <collection name> 
    
  • List all collections:

    qnote ls books
    
  • Delete a collection:

    qnote rm book <collection name>
    
  • Merge collections:

    qnote merge <collection to delete> <collection to move notes to>
    
  • Split collections:

    qnote split query <collection name> <search query>
    qnote split ids <collection name> <note IDs...>
    

Creating and Managing Notes:

  • Create a new note:

    qnote new note 
    
  • Create a note from a URL:

    qnote new url <URL>
    
  • List notes:

    qnote ls notes 
    qnote ls notes all 
    
  • Edit a note:

    qnote edit note <note ID>
    
  • Delete a note:

    qnote rm note <note ID>
    

Searching Notes:

  • Search using phrase prefix:

    qnote search query 
    
  • Search using advanced query syntax:

    qnote search -q <search query> 
    

Re-indexing:

  • If you need to rebuild the search index, use:

    qnote search reindex
    

Backup and Restore:

  • To back up, copy the qnote.db file from the data directory ($HOME/.config/quicknote on Linux and $HOME/Library/Application Support/quicknote on macOS).
  • Exporting to CSV or JSON is also an option.

Command Help:

  • Get information on any command using the help command:

    qnote help <command>
    

Example Usage:

$ qnote help
$ qnote new book Work
$ qnote new note
$ qnote search -q "book:Work AND tag:projectx"
$ qnote ls notes all -f json

Documentation

Index

Constants

View Source
const MaxStringLen = 131070

Always a good idea to have a upper limit

Variables

View Source
var (
	Basic = "basic"
	URL   = "url"

	NoteTypes = []string{
		Basic,
		URL,
	}
)

Note types

Functions

This section is empty.

Types

type Book

type Book struct {
	ID       int64
	Created  time.Time
	Modified time.Time

	Name string
}

Book is a collection of notes

func NewBook

func NewBook() *Book

NewBook returns a new Book

func (*Book) String

func (b *Book) String() string

type Books

type Books []*Book

func (Books) Len

func (b Books) Len() int

func (Books) Less

func (b Books) Less(i, j int) bool

func (Books) Swap

func (b Books) Swap(i, j int)

type DB

type DB interface {
	GetAllNotes(sortBy, order string) (Notes, error)
	GetAllBookNotes(book *Book, sortBy, order string) (Notes, error)
	GetNoteByID(id int64) (*Note, error)
	GetNoteByNote(n *Note) error
	GetNotesByIDs(ids []int64) (Notes, error)
	CreateNote(n *Note) error
	EditNote(n *Note) error
	DeleteNote(n *Note) error

	GetAllBooks() (Books, error)
	GetOrCreateBookByName(name string) (*Book, error)
	GetBookByName(name string) (*Book, error)
	CreateBook(b *Book) error
	MergeBooks(b1 *Book, b2 *Book) error
	EditNoteByIDBook(ids []int64, bk *Book) error
	EditBook(b1 *Book) error
	LoadBook(b *Book) error
	DeleteBook(bk *Book) error

	GetAllBookTags(bk *Book) (Tags, error)
	GetAllTags() (Tags, error)
	CreateTag(t *Tag) error
	LoadNoteTags(n *Note) error
	GetOrCreateTagByName(name string) (*Tag, error)
	GetTagByName(name string) (*Tag, error)

	Close() error
}

DB interface for the database providers

type Index

type Index interface {
	IndexNote(n *Note) error
	IndexNotes(notes Notes) error
	SearchNote(query string, limit, offset int) ([]int64, uint64, error)
	SearchNotePhrase(query string, bk *Book, sort string, limit, offset int) ([]int64, uint64, error)
	DeleteNote(n *Note) error
	DeleteBook(bk *Book) error
}

Index interface for the index providers

type Note

type Note struct {
	ID       int64
	Created  time.Time
	Modified time.Time

	Type  string
	Title string
	Body  string

	Book *Book
	Tags []*Tag
}

Note is our main struct for storing notes and their meta data.

func NewNote

func NewNote() *Note

NewNote returns a new Note

func (*Note) GetTagIDsArray

func (n *Note) GetTagIDsArray() []int64

func (*Note) GetTagStringArray

func (n *Note) GetTagStringArray() []string

GetTagStringArray returns a list of the note's tag names

func (*Note) MarshalJSON

func (n *Note) MarshalJSON() ([]byte, error)

MarshalJSON customer json Marshaler

func (*Note) String

func (n *Note) String() string

type Notes

type Notes []*Note

func (Notes) Len

func (n Notes) Len() int

func (Notes) Less

func (n Notes) Less(i, j int) bool

func (Notes) Swap

func (n Notes) Swap(i, j int)

type Tag

type Tag struct {
	ID       int64
	Created  time.Time
	Modified time.Time

	Name string
}

Tag is a term used as meta data for more accurate searching and labeling.

func NewTag

func NewTag() *Tag

NewTag returns a new Tag

func (*Tag) String

func (t *Tag) String() string

type Tags

type Tags []*Tag

func (Tags) Len

func (t Tags) Len() int

func (Tags) Less

func (t Tags) Less(i, j int) bool

func (Tags) Swap

func (t Tags) Swap(i, j int)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL