cli

package
v0.0.0-...-80c1f95 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddCmd

type AddCmd struct {
	Token string `short:"t" help:"Bearer token (SHORTY_TOKEN)" default:"${token}"`
	URL   string `short:"u" help:"Shorty URL (SHORTY_URL)" default:"${url}"`

	Path        string `arg:"" help:"Redirect path"`
	Destination string `arg:"" help:"Destination URL"`
}

func (*AddCmd) Run

func (c *AddCmd) Run(ctx *Context) error

func (*AddCmd) Validate

func (c *AddCmd) Validate() error

type CLI

type CLI struct {
	Add   AddCmd   `cmd:"" help:"Add a redirect"`
	Get   GetCmd   `cmd:"" help:"Get a redirect"`
	List  ListCmd  `cmd:"" help:"List all redirects"`
	Rm    RmCmd    `cmd:"" help:"Delete a redirect"`
	Start StartCmd `cmd:"" help:"Start Shorty"`
}

type Context

type Context struct {
	Config *viper.Viper
	Log    zerolog.Logger
}

type GetCmd

type GetCmd struct {
	URL string `short:"u" help:"Shorty URL (SHORTY_URL)" default:"${url}"`

	Path string `arg:"" help:"Redirect path"`
}

func (*GetCmd) Run

func (c *GetCmd) Run(ctx *Context) error

func (*GetCmd) Validate

func (c *GetCmd) Validate() error

type ListCmd

type ListCmd struct {
	AllPath string `help:"All-path (SHORTY_ALL_PATH)" default:"${all_path}"`
	Token   string `short:"t" help:"Bearer token (SHORTY_TOKEN)" default:"${token}"`
	URL     string `short:"u" help:"Shorty URL (SHORTY_URL)" default:"${url}"`
}

func (*ListCmd) Run

func (c *ListCmd) Run(ctx *Context) error

type RmCmd

type RmCmd struct {
	Token string `short:"t" help:"Bearer token (SHORTY_TOKEN)" default:"${token}"`
	URL   string `short:"u" help:"Shorty URL (SHORTY_URL)" default:"${url}"`

	Path string `arg:"" help:"Redirect path"`
}

func (*RmCmd) Run

func (c *RmCmd) Run(ctx *Context) error

func (*RmCmd) Validate

func (c *RmCmd) Validate() error

type StartCmd

type StartCmd struct {
	AllPath      string `help:"All-path (SHORTY_ALL_PATH)" default:"${all_path}"`
	DatabasePath string `short:"d" help:"Database path (SHORTY_DATABASE_PATH)" default:"${database_path}"`
	Host         string `short:"h" help:"HTTP bind host (SHORTY_HOST)" default:"${host}"`
	Port         string `short:"p" help:"HTTP port (SHORTY_PORT)" default:"${port}"`
	Token        string `short:"t" help:"Bearer token (SHORTY_TOKEN)" default:"${token}"`
}

func (*StartCmd) Run

func (c *StartCmd) Run(ctx *Context) error

Jump to

Keyboard shortcuts

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