cmd

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: Apache-2.0 Imports: 28 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package cmd is the commands, and flags, of a file search manager, which a program composes, and which imports the handlers of go-metadata which it reads files with.

Index

Constants

View Source
const (

	// DefaultName is the name of the database, in the user's cache folder,
	// when it isn't set
	DefaultName = "filesearch.db"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CatCmd

type CatCmd struct {
	Flags   `embed:""`
	Path    string `arg:"" name:"path" help:"The file's path, or the end of it, such as its name, which is of one file"`
	Artwork bool   `name:"artwork" help:"Its artwork, rather than its content, which is written when it has no content"`
}

CatCmd writes a file's content, as Markdown, or its artwork

func (*CatCmd) Run

func (cmd *CatCmd) Run(ctx server.Cmd) error

Run writes the file's content, as Markdown, which is formatted, on a terminal, or, when it has none, or with --artwork, its artwork, which is drawn, on a terminal, or else is the image's bytes

type Commands

type Commands struct {
	Index        IndexCmd        `` /* 142-byte string literal not displayed */
	Search       SearchCmd       `cmd:"" name:"search" help:"Search the files which are indexed, of words, or list them, without any." group:"FILESEARCH"`
	Volumes      VolumesCmd      `cmd:"" name:"volumes" help:"List the volumes, with the status of their indexing." group:"FILESEARCH"`
	VolumeDelete VolumeDeleteCmd `cmd:"" name:"volume-delete" help:"Delete a volume, by its id, or path, with what's indexed of it." group:"FILESEARCH"`
	Info         InfoCmd         `cmd:"" name:"info" help:"Show what's indexed of a file, of its metadata." group:"FILESEARCH"`
	Cat          CatCmd          `cmd:"" name:"cat" help:"Write a file's content, as Markdown, or, when it has none, its artwork." group:"FILESEARCH"`
}

Commands are the commands of a file search manager, of its database

type Flags

type Flags struct {
	DB      string `` /* 135-byte string literal not displayed */
	Readers int    `name:"readers" help:"The most connections which read the database at once, such as to search it" default:"4"`

	// The names of files and folders which aren't indexed
	Exclude []string `name:"exclude" help:"Regular expressions, of the names of files and folders which aren't indexed, such as '\\.bak$'"`
	// The movies and episodes on TMDB which videos are
	TMDBKey string `` /* 242-byte string literal not displayed */

	DefaultExclude bool `` /* 176-byte string literal not displayed */
}

Flags are the flags of a file search manager

func (Flags) WithManager

func (flags Flags) WithManager(ctx server.Cmd, srv *servercmd.RunServer, fn func(*filesearch.Manager) error, opts ...filesearch.Opt) (err error)

WithManager creates a file search manager, of the database of the flags, with the server's tracer, and then the options, calls the function with it, and closes it, once the function returns, returning any error. The server is where its HTTP handlers are registered, when there is one, once there are some.

type IndexCmd

type IndexCmd struct {
	Flags     `embed:""`
	Path      string `arg:"" name:"folder" help:"The folder, which is a volume, or, without one, all of the volumes" type:"existingdir" optional:""`
	Recursive bool   `name:"recursive" help:"Index the folder's folders, as well as its files" default:"true" negatable:""`
	Reindex   bool   `` /* 134-byte string literal not displayed */
}

IndexCmd indexes a folder, as a volume

func (*IndexCmd) Run

func (cmd *IndexCmd) Run(ctx server.Cmd) error

Run indexes the folder, or, without one, each of the volumes, in turn, with its progress, on a terminal, and says the files which couldn't be read, and then what was indexed, marked and swept, once it's finished. A volume which can't be indexed, such as when its folder is gone, is said, and the others are indexed.

type InfoCmd

type InfoCmd struct {
	Flags `embed:""`
	Path  string `arg:"" name:"path" help:"The file's path, or the end of it, such as its name, which is of one file"`
}

InfoCmd shows what's indexed of a file

func (*InfoCmd) Run

func (cmd *InfoCmd) Run(ctx server.Cmd) error

Run shows what's indexed of the file, as a table of its fields, and its metadata, or JSON, with --debug

type SearchCmd

type SearchCmd struct {
	Flags  `embed:""`
	Words  []string `arg:"" name:"words" help:"Words, which are all in the files' text, as prefixes" optional:""`
	Volume []int64  `name:"volume" help:"The volumes to search, or all of them"`
	Type   []string `` /* 165-byte string literal not displayed */
	Order  string   `` /* 198-byte string literal not displayed */
	Cutoff float64  `` /* 140-byte string literal not displayed */
	Offset uint64   `name:"offset" help:"The offset of the first file"`
	Limit  *uint64  `name:"limit" help:"The most files, which is at most 100"`
}

SearchCmd searches the files which are indexed

func (*SearchCmd) Run

func (cmd *SearchCmd) Run(ctx server.Cmd) error

Run searches the files, of the words, or lists them, without any

type VolumeDeleteCmd

type VolumeDeleteCmd struct {
	Flags  `embed:""`
	Volume string `arg:"" name:"volume" help:"The volume's id, or path"`
}

VolumeDeleteCmd deletes a volume

func (*VolumeDeleteCmd) Run

func (cmd *VolumeDeleteCmd) Run(ctx server.Cmd) error

Run deletes the volume, by its id, or path

type VolumesCmd

type VolumesCmd struct {
	Flags  `embed:""`
	Offset uint64  `name:"offset" help:"The offset of the first volume"`
	Limit  *uint64 `name:"limit" help:"The most volumes, which is at most 100"`
}

VolumesCmd lists the volumes

func (*VolumesCmd) Run

func (cmd *VolumesCmd) Run(ctx server.Cmd) error

Run lists the volumes

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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