cmd

package
v0.0.30 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrFolderNoFolderMutuallyExclusive is returned if folder and no-folder are both provided.
	ErrFolderNoFolderMutuallyExclusive = errors.New("folder/no-folder mutually exclusive")
	// ErrDescriptionNoDescriptionMutuallyExclusive is returned if no-description and description are both provoded.
	ErrDescriptionNoDescriptionMutuallyExclusive = errors.New("description/no-description mutually exclusive")
)

Functions

This section is empty.

Types

type AddBookCmd

type AddBookCmd struct {
	Folder      *string  `help:"Folder to add this bookmark to."`
	Name        *string  `help:"Name for the bookmark."`
	Description *string  `help:"Description of the bookmark."`
	Tag         []string `help:"Tag to apply to the bookmark."`

	URL string `arg:"" name:"url" help:"URL of the bookmark."`
}

AddBookCmd is a CLI command to add a bookmark.

func (*AddBookCmd) Run

func (r *AddBookCmd) Run(ctx *Context) error

Run add a bookmark.

type AddCmd

type AddCmd struct {
	Book   AddBookCmd   `cmd:"" help:"Add a bookmark."`
	Folder AddFolderCmd `cmd:"" help:"Add a folder."`
	Tag    AddTagsCmd   `cmd:"" help:"Add tags to a bookmark."`
}

AddCmd is a CLI command to add a bookmark or folder.

type AddFolderCmd

type AddFolderCmd struct {
	Folder *string `help:"Folder to add this folder to."`

	Name string `arg:"" name:"name" help:"Name for the folder."`
}

AddFolderCmd is a CLI command to add a folder.

func (*AddFolderCmd) Run

func (r *AddFolderCmd) Run(ctx *Context) error

Run add a folder.

type AddTagsCmd

type AddTagsCmd struct {
	Tag []string `help:"Tag to apply to the bookmark."`

	ID string `arg:"" name:"id" help:"ID of the bookmark to add tags to."`
}

AddTagsCmd is a CLI command to add tags to an existing bookmark.

func (*AddTagsCmd) Run

func (r *AddTagsCmd) Run(ctx *Context) error

Run add tags.

type ConfigCmd

type ConfigCmd struct {
	DB DBConfigCmd `cmd:"" help:"Manage the bookmarks database location configuration."`
}

ConfigCmd is a CLI command to manage config.

type Context

type Context struct {
	DB         *string   // bookmarks database to use
	Formatter  Formatter // how to format the output
	Writer     io.Writer // where to write output
	ReturnCode func(int) // set the return code
	Version    string    // the current version of Armaria
}

Context is the context for an invocation of Armaria.

type DBConfigCmd

type DBConfigCmd struct {
	Get GetDBConfigCmd `cmd:"" help:"Get the location of the bookmarks database from the configuration."`
	Set SetDBConfigCmd `cmd:"" help:"Set the location of the bookmarks database in the configuration."`
}

DBConfigCmd is a CLI command to manage the bookmarks database location config.

type Formatter

type Formatter string

Formatter is the way output should be formatted.

const (
	FormatterJSON   Formatter = "json"   // format results as JSON.
	FormatterPretty Formatter = "pretty" // format results in human readable way.
)

type GetAllCmd

type GetAllCmd struct {
	ID string `arg:"" name:"id" help:"ID of the bookmark or folder to get."`
}

GetAllCmd is a CLI command to get a bookmark or folder.

func (*GetAllCmd) Run

func (r *GetAllCmd) Run(ctx *Context) error

Run get bookmark or folder.

type GetCmd

type GetCmd struct {
	All GetAllCmd `cmd:"" help:"Get a bookmark or folder."`
}

GetCmd is a CLI command to get bookmarks/folders.

type GetDBConfigCmd

type GetDBConfigCmd struct {
}

GetDBConfigCmd is a CLI command to get the location of the bookmarks database from the config.

func (*GetDBConfigCmd) Run

func (r *GetDBConfigCmd) Run(ctx *Context) error

Run get the location of the bookmarks database from the config.

type InstallChromeManifestCmd

type InstallChromeManifestCmd struct {
}

InstallChromeManifestCmd is a CLI command to install the app manifest for Chrome.

func (*InstallChromeManifestCmd) Run

func (r *InstallChromeManifestCmd) Run(ctx *Context) error

Run install app manifest for Chrome.

type InstallChromiumManifestCmd

type InstallChromiumManifestCmd struct {
}

InstallChromiumManifestCmd is a CLI command to install the app manifest for Chromium.

func (*InstallChromiumManifestCmd) Run

Run install app manifest for Chromium.

type InstallFirefoxManifestCmd

type InstallFirefoxManifestCmd struct {
}

InstallFirefoxManifestCmd is a CLI command to install the app manifest for Firefox.

func (*InstallFirefoxManifestCmd) Run

Run install app manifest for Firefox.

type InstallManifestCmd

type InstallManifestCmd struct {
	Firefox  InstallFirefoxManifestCmd  `cmd:"" help:"Install the app manifest for Firefox."`
	Chrome   InstallChromeManifestCmd   `cmd:"" help:"Install the app manifest for Chrome."`
	Chromium InstallChromiumManifestCmd `cmd:"" help:"Install the app manifest for Chromium."`
}

InstallManifestCmd is a CLI command to the app manifest.

type ListAllCmd

type ListAllCmd struct {
	Folder   *string           `help:"Folder to list bookmarks/folders in."`
	NoFolder bool              `help:"List top level bookmarks/folders."`
	After    *string           `help:"ID of bookmark/folder to return results after."`
	Query    *string           `help:"Query to search bookmarks/folders by."`
	Tag      []string          `help:"Tag to filter bookmarks/folders by."`
	Order    armaria.Order     `help:"Field results are ordered on: modified/name/manual." enum:"modified,name,manual" default:"manual"`
	Dir      armaria.Direction `help:"Direction results are ordered by: asc/desc." enum:"asc,desc" default:"asc"`
	First    *int64            `help:"The max number of bookmarks/folders to return."`
}

ListAllCmd is a CLI command to list bookmarks and folders.

func (*ListAllCmd) Run

func (r *ListAllCmd) Run(ctx *Context) error

Run list bookmarks and folders.

type ListBooksCmd

type ListBooksCmd struct {
	Folder   *string           `help:"Folder to list bookmarks in."`
	NoFolder bool              `help:"List top level bookmarks."`
	After    *string           `help:"ID of bookmark to return results after."`
	Query    *string           `help:"Query to search bookmarks by."`
	Tag      []string          `help:"Tag to filter bookmarks by."`
	Order    armaria.Order     `help:"Field results are ordered on: modified/name/manual." enum:"modified,name,manual" default:"manual"`
	Dir      armaria.Direction `help:"Direction results are ordered by: asc/desc." enum:"asc,desc" default:"asc"`
	First    *int64            `help:"The max number of bookmarks to return."`
}

ListBooksCmd is a CLI command to list bookmarks.

func (*ListBooksCmd) Run

func (r *ListBooksCmd) Run(ctx *Context) error

Run list bookmarks.

type ListCmd

type ListCmd struct {
	All         ListAllCmd         `cmd:"" help:"List bookmarks and folders."`
	Books       ListBooksCmd       `cmd:"" help:"List bookmarks."`
	Folders     ListFoldersCmd     `cmd:"" help:"List folders."`
	Tags        ListTagsCmd        `cmd:"" help:"List tags."`
	ParentNames ListParentNamesCmd `cmd:"" help:"List parent names."`
}

ListCmd is a CLI command to list bookmarks/folders/tags.

type ListFoldersCmd

type ListFoldersCmd struct {
	Folder   *string           `help:"Folder to list folders in."`
	NoFolder bool              `help:"List top level folders."`
	After    *string           `help:"ID of folder to return results after."`
	Query    *string           `help:"Query to search folders by."`
	Tag      []string          `help:"Tag to filter folders by."`
	Order    armaria.Order     `help:"Field results are ordered on: modified/name/manual." enum:"modified,name,manual" default:"manual"`
	Dir      armaria.Direction `help:"Direction results are ordered by: asc/desc." enum:"asc,desc" default:"asc"`
	First    *int64            `help:"The max number of folders to return."`
}

ListFoldersCmd is a CLI command to list folders.

func (*ListFoldersCmd) Run

func (r *ListFoldersCmd) Run(ctx *Context) error

Run list folders.

type ListParentNamesCmd

type ListParentNamesCmd struct {
	ID string `arg:"" name:"id" help:"ID of the bookmark/folder to the parent names of."`
}

ListParentNamesCmd is a CLI command to get the parent names of a bookmark/folder.

func (*ListParentNamesCmd) Run

func (r *ListParentNamesCmd) Run(ctx *Context) error

Run get the parent names of a bookmark

type ListTagsCmd

type ListTagsCmd struct {
	Query *string           `help:"Query to search tags by."`
	After *string           `help:"ID of tags to return results after."`
	Dir   armaria.Direction `help:"Direction results are ordered by: asc/desc." enum:"asc,desc" default:"asc"`
	First *int64            `help:"The max number of tags to return."`
}

ListTagsCmd is a CLI command to list tags.

func (*ListTagsCmd) Run

func (r *ListTagsCmd) Run(ctx *Context) error

Run list tags.

type ManifestCmd

type ManifestCmd struct {
	Install InstallManifestCmd `cmd:"" help:"Install the app manifest"`
}

ManifestCmd is a CLI command to manage the app manifest.

type QueryCmd

type QueryCmd struct {
	First int64 `help:"The max number of bookmarks/folders to return." default:"5"`

	Query string `arg:"" name:"query" help:"Query to search by."`
}

QueryCmd is a CLI command to query bookmarks.

func (*QueryCmd) Run

func (r *QueryCmd) Run(ctx *Context) error

Run query bookmarks.

type RemoveBookCmd

type RemoveBookCmd struct {
	ID string `arg:"" name:"id" help:"ID of the bookmark to remove."`
}

RemoveBookCmd is a CLI command to remove a bookmark.

func (*RemoveBookCmd) Run

func (r *RemoveBookCmd) Run(ctx *Context) error

Run remove a bookmark.

type RemoveCmd

type RemoveCmd struct {
	Book   RemoveBookCmd   `cmd:"" help:"Remove a bookmark."`
	Folder RemoveFolderCmd `cmd:"" help:"Remove a folder."`
	Tag    RemoveTagsCmd   `cmd:"" help:"Remove tags from a bookmark."`
}

RemoveCmd is a CLI command to remove a folder or bookmark.

type RemoveFolderCmd

type RemoveFolderCmd struct {
	ID string `arg:"" name:"id" help:"ID of the folder to remove."`
}

RemoveFolderCmd is a CLI command to remove a folder.

func (*RemoveFolderCmd) Run

func (r *RemoveFolderCmd) Run(ctx *Context) error

Run remove a folder.

type RemoveTagsCmd

type RemoveTagsCmd struct {
	Tag []string `help:"Tag to remove from the bookmark."`

	ID string `arg:"" name:"id" help:"ID of the bookmark to remove tags from."`
}

RemoveTagsCmd is a CLI command to add remove tags from an existing bookmark.

func (*RemoveTagsCmd) Run

func (r *RemoveTagsCmd) Run(ctx *Context) error

Run remove tags.

type RootCmd

type RootCmd struct {
	DB        *string   `help:"Location of the bookmarks database."`
	Formatter Formatter `help:"How to format output: pretty/json." enum:"json,pretty" default:"pretty"`

	Add    AddCmd    `cmd:"" help:"Add a folder, bookmark, or tag."`
	Remove RemoveCmd `cmd:"" help:"Remove a folder, bookmark, or tag."`
	Update UpdateCmd `cmd:"" help:"Update a folder or bookmark."`
	List   ListCmd   `cmd:"" help:"List folders, bookmarks, or tags."`
	Get    GetCmd    `cmd:"" help:"Get a folder or bookmark."`
	Query  QueryCmd  `cmd:"" help:"Query folders and bookmarks."`

	Config   ConfigCmd   `cmd:"" help:"Manage the configuration."`
	Manifest ManifestCmd `cmd:"" help:"Manage the app manifest."`

	TUI TUICommand `cmd:"" help:"Start the TUI."`

	Version VersionCmd `cmd:"" help:"Print the current version."`
}

RootCmd is the top level CLI command for Armaria.

func RootCmdFactory

func RootCmdFactory() RootCmd

RootCmdFactory creates a new RootCmd.

type SetDBConfigCmd

type SetDBConfigCmd struct {
	DB string `arg:"" name:"db" help:"Location of the bookmarks database."`
}

SetDBConfigCmd is a CLI command to set the location of the bookmarks database in the config.

func (*SetDBConfigCmd) Run

func (r *SetDBConfigCmd) Run(ctx *Context) error

Run set the location of the bookmarks database in the config.

type TUICommand

type TUICommand struct {
}

TUICommand is a CLI command to start the TUI.

func (*TUICommand) Run

func (r *TUICommand) Run(ctx *Context) error

Run start the TUI.

type UpdateBookCmd

type UpdateBookCmd struct {
	Folder        *string `help:"Folder to move this bookmark to."`
	NoFolder      bool    `help:"Remove the parent folder."`
	Name          *string `help:"New name for this bookmark."`
	Description   *string `help:"New description for this bookmark."`
	NoDescription bool    `help:"Remove the description."`
	URL           *string `help:"New URL for this bookmark."`
	Before        *string `help:"Book to order this bookmark before."`
	After         *string `help:"Book to order this bookmark after."`

	ID string `arg:"" name:"id" help:"ID of the bookmark to update."`
}

UpdateBookCmd is a CLI command to update a bookmark.

func (*UpdateBookCmd) Run

func (r *UpdateBookCmd) Run(ctx *Context) error

Run update a bookmark.

type UpdateCmd

type UpdateCmd struct {
	Book   UpdateBookCmd   `cmd:"" help:"Update a bookmark."`
	Folder UpdateFolderCmd `cmd:"" help:"Update a folder."`
}

UpdateCmd is a CLI command to update a bookmark or folder.

type UpdateFolderCmd

type UpdateFolderCmd struct {
	Name     *string `help:"New name for this folder."`
	Folder   *string `help:"Folder to move this folder to."`
	NoFolder bool    `help:"Remove the parent folder."`
	Before   *string `help:"Book to order this bookmark before."`
	After    *string `help:"Book to order this bookmark after."`

	ID string `arg:"" name:"id" help:"ID of the folder to update."`
}

UpdateFolderCmd is a CLI command to update a folder.

func (*UpdateFolderCmd) Run

func (r *UpdateFolderCmd) Run(ctx *Context) error

Run update a folder.

type VersionCmd

type VersionCmd struct {
}

VersionCmd is a CLI command to print the current version.

func (*VersionCmd) Run

func (r *VersionCmd) Run(ctx *Context) error

Run print the current version.

Directories

Path Synopsis
messaging contains the logic for Armaria to communicate with JSON.
messaging contains the logic for Armaria to communicate with JSON.
tui

Jump to

Keyboard shortcuts

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