Rename every occurrence of "slip box" into "notebook"

This commit is contained in:
Mickaël Menu 2021-02-15 22:44:31 +01:00
parent 55ea92f52b
commit 4c8a7b4105
No known key found for this signature in database
GPG Key ID: 53D73664CD359895
10 changed files with 31 additions and 31 deletions

View File

@ -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

View File

@ -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)

View File

@ -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."`

View File

@ -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
}

View File

@ -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."`

View File

@ -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) {

View File

@ -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 {

View File

@ -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")

View File

@ -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)

View File

@ -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)