commandline

package
v1.0.56 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package commandline is responsible for creating, parsing and validating command line arguments.

Index

Constants

View Source
const Bash = "bash"
View Source
const CredentialsAuth = "credentials"
View Source
const DefinitionsDirectory = "definitions"
View Source
const LoginAuth = "login"
View Source
const PatAuth = "pat"
View Source
const Powershell = "powershell"

Variables

This section is empty.

Functions

func BashrcPath added in v1.0.3

func BashrcPath() (string, error)

Returns .bashrc path on linux

func PowershellProfilePath added in v1.0.3

func PowershellProfilePath() (string, error)

Returns powershell profile path on linux

Types

type AutoCompleteHandler

type AutoCompleteHandler struct {
}

AutoCompleteHandler parses the autocomplete command and provides suggestions for the available commands. It tries to perform a prefix- as well as contains-match based on the current context. Example: uipath autocomplete complete --command "uipath o" returns: oms orchestrator documentunderstanding

func (AutoCompleteHandler) EnableCompleter added in v1.0.3

func (a AutoCompleteHandler) EnableCompleter(shell string, filePath string) (string, error)

func (AutoCompleteHandler) Find

func (a AutoCompleteHandler) Find(commandText string, commands []*cli.Command, exclude []string) []string

type Cli

type Cli struct {
	StdIn              io.Reader
	StdOut             io.Writer
	StdErr             io.Writer
	ColoredOutput      bool
	DefinitionProvider DefinitionProvider
	ConfigProvider     config.ConfigProvider
	Executor           executor.Executor
	PluginExecutor     executor.Executor
}

Cli is a wrapper for building the CLI commands.

func (Cli) Run

func (c Cli) Run(args []string, input []byte) error

type CommandBuilder

type CommandBuilder struct {
	Input              []byte
	StdIn              io.Reader
	StdOut             io.Writer
	StdErr             io.Writer
	ConfigProvider     config.ConfigProvider
	Executor           executor.Executor
	PluginExecutor     executor.Executor
	DefinitionProvider DefinitionProvider
}

The CommandBuilder is creating all available operations and arguments for the CLI.

func (CommandBuilder) Create

func (b CommandBuilder) Create(args []string) ([]*cli.Command, error)

func (CommandBuilder) CreateDefaultFlags

func (b CommandBuilder) CreateDefaultFlags(hidden bool) []cli.Flag

func (CommandBuilder) HelpFlag

func (b CommandBuilder) HelpFlag() cli.Flag

type ConfigCommandHandler

type ConfigCommandHandler struct {
	StdIn          io.Reader
	StdOut         io.Writer
	ConfigProvider config.ConfigProvider
}

The ConfigCommandHandler implements commands for configuring the CLI. The CLI can be configured interactively or by setting config values programmatically.

Example: uipath config ==> interactive configuration of the CLI uipath config set ==> stores a value in the configuration file

func (ConfigCommandHandler) Configure

func (h ConfigCommandHandler) Configure(auth string, profileName string) error

func (ConfigCommandHandler) Set added in v1.0.47

func (h ConfigCommandHandler) Set(key string, value string, profileName string) error

type DefinitionData

type DefinitionData struct {
	Name string
	Data []byte
}

DefinitionData contains the name of the definition file and its data.

func NewDefinitionData

func NewDefinitionData(name string, data []byte) *DefinitionData

type DefinitionProvider added in v1.0.17

type DefinitionProvider struct {
	DefinitionStore DefinitionStore
	Parser          parser.Parser
	CommandPlugins  []plugin.CommandPlugin
}

The DefinitionProvider uses the store to read the definition files. It parses the definition files and also supports merging multiple files for the same service.

The following mapping is performed between the files on disk and the commands the CLI provides: orchestrator.yaml => uipath orchestrator ... du.metering.yaml => uipath du ... du.events.yaml => uipath du ...

For performance reasons, the definition provider always just loads the definition files belonging to a single service. There is no need to load the definition file for the du service when the user executes 'uipath orchestrator', for example.

func (DefinitionProvider) Index added in v1.0.17

func (p DefinitionProvider) Index() ([]parser.Definition, error)

func (DefinitionProvider) Load added in v1.0.17

func (p DefinitionProvider) Load(name string) (*parser.Definition, error)

type DefinitionStore added in v1.0.17

type DefinitionStore struct {
	DefinitionDirectory string
	DefinitionFiles     []string
	Definitions         []DefinitionData
}

DefinitionStore discovers the definition files from disk searching for the definitions/ folder and returns the data for a particular definition file.

func (*DefinitionStore) Names added in v1.0.17

func (s *DefinitionStore) Names() ([]string, error)

func (*DefinitionStore) Read added in v1.0.17

func (s *DefinitionStore) Read(name string) (*DefinitionData, error)

type MultiDefinition added in v1.0.26

type MultiDefinition struct{}

MultiDefinition merges multiple definitions into a single one. This enables teams to provide fine-grained specifications for their individual micro-services and still provide them under a single command.

func (MultiDefinition) Merge added in v1.0.26

func (d MultiDefinition) Merge(name string, definitions []*parser.Definition) *parser.Definition

type TypeConverter

type TypeConverter struct{}

The TypeConverter converts the string value from the command-line argument into the type the definition declared. CLI arguments are always passed as strings and need to be converted to their respective type.

func (TypeConverter) Convert

func (c TypeConverter) Convert(value string, parameter parser.Parameter) (interface{}, error)

type UriBuilder added in v1.0.5

type UriBuilder struct {
	// contains filtered or unexported fields
}

UriBuilder merges parts of the uri so that they can be overridden from multiple sources, like environment variables, config files or command line arguments.

func NewUriBuilder added in v1.0.5

func NewUriBuilder(uri url.URL) *UriBuilder

func (*UriBuilder) OverrideUri added in v1.0.5

func (b *UriBuilder) OverrideUri(overrideUri *url.URL)

func (UriBuilder) Uri added in v1.0.5

func (b UriBuilder) Uri() url.URL

Jump to

Keyboard shortcuts

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