cli

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: May 26, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindProjectFile

func FindProjectFile(name, file string) (string, error)

FindProjectFile parses the cli arguments and returns a runtime configuration.

func ShimArgs added in v0.1.1

func ShimArgs(args []string) []string

ShimArgs handle special cases when running the program: - If running without any arguments, default to the --help flag. - If running with a compound `project:windows` argument, split it.

Types

type CLI

type CLI struct {
	client.Options

	Start   StartCmd   `cmd:"" help:"Start a tmux session." aliases:"star,sta" default:"withargs"`
	Stop    StopCmd    `cmd:"" help:"Stop a tmux session." aliases:"sto"`
	Print   PrintCmd   `cmd:"" help:"Print the current tmux session's configuration." aliases:"pr,p"`
	List    ListCmd    `cmd:"" help:"List all projects, or project's windows." aliases:"l,ls"`
	Edit    EditCmd    `cmd:"" help:"Edit the a tmux session configuration." aliases:"ed,e"`
	New     NewCmd     `cmd:"" help:"Create a new tmux session." aliases:"ne,n"`
	Switch  SwitchCmd  `cmd:"" help:"Switch to existing tmux session." aliases:"swi,sw"`
	Version VersionCmd `cmd:"" help:"Display version information." aliases:"ver,v"`
}

func NewApp

func NewApp(opts ...kong.Option) (CLI, *kong.Context)

NewApp creates a new CLI application.

type EditCmd

type EditCmd struct {
	Project string `arg:"" optional:"" help:"Optional project name."`
}

func (*EditCmd) Run

func (c *EditCmd) Run(jig client.Jig) error

Run executes the edit command.

type ErrConfigNotFound

type ErrConfigNotFound struct{ Project, Path string }

func (ErrConfigNotFound) Error

func (e ErrConfigNotFound) Error() string

type ListCmd

type ListCmd struct {
	Project string `help:"Optional project name to list windows." arg:"" optional:""`
}

func (*ListCmd) Run

func (c *ListCmd) Run(jig client.Jig) error

Run executes the list command.

type NewCmd

type NewCmd struct {
	Project string `arg:"" optional:"" help:"Optional project name."`
}

func (*NewCmd) Run

func (c *NewCmd) Run(jig client.Jig) error

Run executes the new command.

type PrintCmd

type PrintCmd struct {
	Session string `arg:"" optional:"" help:"Optional session name instead of current."`
}

func (*PrintCmd) Run

func (c *PrintCmd) Run(jig client.Jig) error

Run executes the print command.

type StartCmd

type StartCmd struct {
	Project   string            `help:"Project name to stop." arg:"" optional:""`
	Variables map[string]string `help:"Variable to interpolate in session config." arg:"" optional:""`
	Windows   []string          `help:"List of windows to start. If session exists, those windows will be attached to current session." short:"w" sep:","`
}

func (*StartCmd) Run

func (c *StartCmd) Run(jig client.Jig) error

Run executes the start command.

type StopCmd

type StopCmd struct {
	Project   string            `help:"Project name to start." arg:"" optional:""`
	Variables map[string]string `help:"Variable to interpolate in session config." arg:"" optional:""`
	Windows   []string          `help:"List of windows to stop." short:"w" sep:","`
}

func (*StopCmd) Run

func (c *StopCmd) Run(jig client.Jig) error

Run executes the stop command.

type SwitchCmd

type SwitchCmd struct {
	Session string `arg:"" optional:"" help:"Optional session name to switch to."`
}

func (*SwitchCmd) Run

func (c *SwitchCmd) Run(jig client.Jig) error

Run executes the switch command.

type VersionCmd

type VersionCmd struct{}

func (*VersionCmd) Run

func (c *VersionCmd) Run(jig client.Jig) error

Run executes the version command.

Jump to

Keyboard shortcuts

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