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 ¶
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
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 ¶
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
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
type VolumeDeleteCmd ¶
type VolumeDeleteCmd struct {
Flags `embed:""`
Volume string `arg:"" name:"volume" help:"The volume's id, or path"`
}
VolumeDeleteCmd deletes a volume
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