From 4c8a7b41056c27de64161a2f76462058aa4d8ff4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mickae=CC=88l=20Menu?= Date: Mon, 15 Feb 2021 22:44:31 +0100 Subject: [PATCH] Rename every occurrence of "slip box" into "notebook" --- adapter/fzf/finder.go | 4 ++-- cmd/container.go | 2 +- cmd/index.go | 2 +- cmd/init.go | 6 +++--- cmd/new.go | 2 +- core/note/format.go | 2 +- core/note/index.go | 4 ++-- core/style/style.go | 2 +- core/zk/zk.go | 30 +++++++++++++++--------------- main.go | 8 ++++---- 10 files changed, 31 insertions(+), 31 deletions(-) diff --git a/adapter/fzf/finder.go b/adapter/fzf/finder.go index f95615f..2e67a63 100644 --- a/adapter/fzf/finder.go +++ b/adapter/fzf/finder.go @@ -22,7 +22,7 @@ type NoteFinder struct { // NoteFinderOpts holds the configuration for the fzf notes finder. // -// The absolute path to the slip box (BasePath) and the working directory +// The absolute path to the notebook (BasePath) and the working directory // (CurrentPath) are used to make the path of each note relative to the working // directory. type NoteFinderOpts struct { @@ -33,7 +33,7 @@ type NoteFinderOpts struct { // When non nil, a "create new note from query" binding will be added to // fzf to create a note in this directory. NewNoteDir *zk.Dir - // Absolute path to the slip box. + // Absolute path to the notebook. BasePath string // Path to the working directory. CurrentPath string diff --git a/cmd/container.go b/cmd/container.go index 58b1660..102ccfa 100644 --- a/cmd/container.go +++ b/cmd/container.go @@ -66,7 +66,7 @@ func (c *Container) NoteFinder(tx sqlite.Transaction, opts fzf.NoteFinderOpts) * return fzf.NewNoteFinder(opts, notes, c.Terminal) } -// Database returns the DB instance for the given slip box, after executing any +// Database returns the DB instance for the given notebook, after executing any // pending migration. func (c *Container) Database(path string) (*sqlite.DB, error) { db, err := sqlite.Open(path) diff --git a/cmd/index.go b/cmd/index.go index fde24d6..cf873e7 100644 --- a/cmd/index.go +++ b/cmd/index.go @@ -11,7 +11,7 @@ import ( "github.com/schollz/progressbar/v3" ) -// Index indexes the content of all the notes in the slip box. +// Index indexes the content of all the notes in the notebook. type Index struct { Force bool `short:"f" help:"Force indexing all the notes."` Quiet bool `short:"q" help:"Do not print statistics nor progress."` diff --git a/cmd/init.go b/cmd/init.go index 861d448..4089607 100644 --- a/cmd/init.go +++ b/cmd/init.go @@ -7,9 +7,9 @@ import ( "github.com/mickael-menu/zk/core/zk" ) -// Init creates a slip box in the given directory +// Init creates a notebook in the given directory type Init struct { - Directory string `arg optional type:"path" default:"." help:"Directory containing the slip box."` + Directory string `arg optional type:"path" default:"." help:"Directory containing the notebook."` } func (cmd *Init) Run() error { @@ -20,7 +20,7 @@ func (cmd *Init) Run() error { path = cmd.Directory } - fmt.Printf("Initialized a slip box in %v\n", path) + fmt.Printf("Initialized a notebook in %v\n", path) } return err } diff --git a/cmd/new.go b/cmd/new.go index 355d990..9852a69 100644 --- a/cmd/new.go +++ b/cmd/new.go @@ -9,7 +9,7 @@ import ( "github.com/mickael-menu/zk/util/os" ) -// New adds a new note to the slip box. +// New adds a new note to the notebook. type New struct { Directory string `arg optional type:"path" default:"." help:"Directory in which to create the note."` diff --git a/core/note/format.go b/core/note/format.go index a22c977..a6ea64a 100644 --- a/core/note/format.go +++ b/core/note/format.go @@ -22,7 +22,7 @@ type Formatter struct { // NewFormatter creates a Formatter from a given format template. // -// The absolute path to the slip box (basePath) and the working directory +// The absolute path to the notebook (basePath) and the working directory // (currentPath) are used to make the path of each note relative to the working // directory. func NewFormatter(basePath string, currentPath string, format opt.String, templates templ.Loader, styler style.Styler) (*Formatter, error) { diff --git a/core/note/index.go b/core/note/index.go index 8218e9b..9704645 100644 --- a/core/note/index.go +++ b/core/note/index.go @@ -64,7 +64,7 @@ type Indexer interface { Remove(path string) error } -// Index indexes the content of the notes in the given slip box. +// Index indexes the content of the notes in the given notebook. func Index(zk *zk.Zk, force bool, parser Parser, indexer Indexer, logger util.Logger, callback func(change paths.DiffChange)) (IndexingStats, error) { wrap := errors.Wrapper("indexing failed") @@ -139,7 +139,7 @@ func metadata(path string, zk *zk.Zk, parser Parser) (Metadata, error) { for _, link := range contentParts.Links { if !strutil.IsURL(link.Href) { - // Make the href relative to the slip box root. + // Make the href relative to the notebook root. href := filepath.Join(filepath.Dir(absPath), link.Href) link.Href, err = zk.RelPath(href) if err != nil { diff --git a/core/style/style.go b/core/style/style.go index 4ac2f4d..b8b2b52 100644 --- a/core/style/style.go +++ b/core/style/style.go @@ -15,7 +15,7 @@ type Rule string var ( // Title of a note. RuleTitle = Rule("title") - // Path to slip box file. + // Path to notebook file. RulePath = Rule("path") // Searched for term in a note. RuleTerm = Rule("term") diff --git a/core/zk/zk.go b/core/zk/zk.go index af0ab5c..29808c5 100644 --- a/core/zk/zk.go +++ b/core/zk/zk.go @@ -135,17 +135,17 @@ const defaultConfig = `# zk configuration file #conf = '$EDITOR "$ZK_PATH/.zk/config.toml"' ` -// Zk (Zettelkasten) represents an opened slip box. +// Zk (Zettelkasten) represents an opened notebook. type Zk struct { - // Slip box root path. + // Notebook root path. Path string // Global user configuration. Config Config } -// Dir represents a directory inside a slip box. +// Dir represents a directory inside a notebook. type Dir struct { - // Name of the directory, which is the path relative to the slip box's root. + // Name of the directory, which is the path relative to the notebook's root. Name string // Absolute path to the directory. Path string @@ -153,7 +153,7 @@ type Dir struct { Config DirConfig } -// Open locates a slip box at the given path and parses its configuration. +// Open locates a notebook at the given path and parses its configuration. func Open(path string) (*Zk, error) { wrap := errors.Wrapper("open failed") @@ -183,7 +183,7 @@ func Open(path string) (*Zk, error) { }, nil } -// Create initializes a new slip box at the given path. +// Create initializes a new notebook at the given path. func Create(path string) error { wrap := errors.Wrapper("init failed") @@ -193,7 +193,7 @@ func Create(path string) error { } if existingPath, err := locateRoot(path); err == nil { - return wrap(fmt.Errorf("a slip box already exists in %v", existingPath)) + return wrap(fmt.Errorf("a notebook already exists in %v", existingPath)) } // Create .zk and .zk/templates directories. @@ -215,7 +215,7 @@ func Create(path string) error { return nil } -// locate finds the root of the slip box containing the given path. +// locate finds the root of the notebook containing the given path. func locateRoot(path string) (string, error) { if !filepath.IsAbs(path) { panic("absolute path expected") @@ -224,7 +224,7 @@ func locateRoot(path string) (string, error) { var locate func(string) (string, error) locate = func(currentPath string) (string, error) { if currentPath == "/" || currentPath == "." { - return "", fmt.Errorf("no slip box found in %v or a parent directory", path) + return "", fmt.Errorf("no notebook found in %v or a parent directory", path) } exists, err := paths.DirExists(filepath.Join(currentPath, ".zk")) switch { @@ -240,14 +240,14 @@ func locateRoot(path string) (string, error) { return locate(path) } -// DBPath returns the path to the slip box database. +// DBPath returns the path to the notebook database. func (zk *Zk) DBPath() string { return filepath.Join(zk.Path, ".zk/data.db") } -// RelPath returns the path relative to the slip box root to the given path. +// RelPath returns the path relative to the notebook root to the given path. func (zk *Zk) RelPath(path string) (string, error) { - wrap := errors.Wrapperf("%v: not a valid slip box path", path) + wrap := errors.Wrapperf("%v: not a valid notebook path", path) path, err := filepath.Abs(path) if err != nil { @@ -263,7 +263,7 @@ func (zk *Zk) RelPath(path string) (string, error) { return path, nil } -// RootDir returns the root Dir for this slip box. +// RootDir returns the root Dir for this notebook. func (zk *Zk) RootDir() Dir { return Dir{ Name: "", @@ -272,11 +272,11 @@ func (zk *Zk) RootDir() Dir { } } -// DirAt returns a Dir representation of the slip box directory at the given path. +// DirAt returns a Dir representation of the notebook directory at the given path. func (zk *Zk) DirAt(path string, overrides ...ConfigOverrides) (*Dir, error) { path, err := filepath.Abs(path) if err != nil { - return nil, errors.Wrapf(err, "%v: not a valid slip box directory", path) + return nil, errors.Wrapf(err, "%v: not a valid notebook directory", path) } name, err := zk.RelPath(path) diff --git a/main.go b/main.go index 166d4fe..3762a16 100644 --- a/main.go +++ b/main.go @@ -15,10 +15,10 @@ var Version = "dev" var Build = "dev" var cli struct { - Init cmd.Init `cmd group:"zk" help:"Create a new slip box in the given directory."` + Init cmd.Init `cmd group:"zk" help:"Create a new notebook in the given directory."` Index cmd.Index `cmd group:"zk" help:"Index the notes to be searchable."` - New cmd.New `cmd group:"notes" help:"Create a new note in the given slip box directory."` + New cmd.New `cmd group:"notes" help:"Create a new note in the given notebook directory."` List cmd.List `cmd group:"notes" help:"List notes matching the given criteria."` Edit cmd.Edit `cmd group:"notes" help:"Edit notes matching the given criteria."` @@ -85,7 +85,7 @@ func options(container *cmd.Container) []kong.Option { "sort": "Sorting", "format": "Formatting", "notes": term.MustStyle("NOTES", style.RuleYellow, style.RuleBold) + "\n" + term.MustStyle("Edit or browse your notes", style.RuleBold), - "zk": term.MustStyle("SLIP BOX", style.RuleYellow, style.RuleBold) + "\n" + term.MustStyle("A slip box is a directory containing your notes", style.RuleBold), + "zk": term.MustStyle("NOTEBOOK", style.RuleYellow, style.RuleBold) + "\n" + term.MustStyle("A notebook is a directory containing a collection of notes", style.RuleBold), }), } } @@ -97,7 +97,7 @@ func fatalIfError(err error) { } } -// indexZk will index any slip box in the working directory. +// indexZk will index any notebook in the working directory. func indexZk(container *cmd.Container) { if len(os.Args) > 1 && os.Args[1] != "index" { (&cmd.Index{Quiet: true}).Run(container)