cmd

package
v0.0.0-...-a9b0cfc Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2023 License: MIT Imports: 12 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 BookDTO

type BookDTO struct {
	ID          string         `json:"id"`
	URL         lib.NullString `json:"url"`
	Name        string         `json:"name"`
	Description lib.NullString `json:"description"`
	ParentID    lib.NullString `json:"parentId"`
	IsFolder    bool           `json:"idFolder"`
	ParentName  lib.NullString `json:"parentName"`
	Tags        []string       `json:"tags"`
}

BookDTO is a bookmark or folder that can be marshalled into JSON.

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
}

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"
	FormatterPretty Formatter = "pretty"
)

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 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    lib.Order     `help:"Field results are ordered on: modified/name." enum:"modified,name" default:"modified"`
	Dir      lib.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    lib.Order     `help:"Field results are ordered on: modified/name." enum:"modified,name" default:"modified"`
	Dir      lib.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."`
}

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    lib.Order     `help:"Field results are ordered on: modified/name." enum:"modified,name" default:"modified"`
	Dir      lib.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 ListTagsCmd

type ListTagsCmd struct {
	Query *string       `help:"Query to search tags by."`
	After *string       `help:"ID of tags to return results after."`
	Dir   lib.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 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."`

	Config ConfigCmd `cmd:"" help:"Manage the configuration."`
}

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

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

	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.

Jump to

Keyboard shortcuts

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