client

package
v1.27.0 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package client provides utility functions for gluing new commands easily into sanssh.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateSynopsis

func GenerateSynopsis(c *subcommands.Commander, leading int) string

GenerateSynopsis will generate a consistent snnopysis for a top level command with N sub-commands contained within it. The leading param indicates the number of leading tabs to generate before the name and synopsis. Generally this is 2 unless you're a subcommand of a subcommand and then you'll want more.

func GenerateUsage

func GenerateUsage(name string, synopsis string) string

GenerateUsage will return a usage string to a top level command with N sub-commands contained within it.

func SetupSubpackage

func SetupSubpackage(name string, f *flag.FlagSet) *subcommands.Commander

SetupSubpackage is a helper to create a Commander to hold the actual commands run inside of a top-level command. The returned Commander should then have the relevant sub-commands registered within it.

Types

type HasSubpackage added in v1.18.1

type HasSubpackage interface {
	GetSubpackage(f *flag.FlagSet) *subcommands.Commander
}

HasSubpackage should be implemented by users of SetupSubpackage to help with introspecting subpackages of subcommands.

type PredictArgs added in v1.18.1

type PredictArgs interface {
	// PredictArgs returns prediction options for a given prefix. The prefix is
	// the subcommand arguments that have been typed so far (possibly nothing)
	// and can be used as a hint for what to return. The returned values will be
	// automatically filtered by the prefix when needed.
	PredictArgs(prefix string) []string
}

PredictArgs can optionally be implemented to help with command-line completion. It will typically be implemented on a type that already implements subcommands.Command.

Jump to

Keyboard shortcuts

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