commandline

package
v1.0.107 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: MIT Imports: 24 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 FromStdIn = "-"
View Source
const LoginAuth = "login"
View Source
const PatAuth = "pat"
View Source
const Powershell = "powershell"

Variables

This section is empty.

Functions

func BashrcPath

func BashrcPath() (string, error)

Returns .bashrc path on linux

func PowershellProfilePath

func PowershellProfilePath() (string, error)

Returns powershell profile path on linux

Types

type Cli

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

Cli is a wrapper for building the CLI commands.

func NewCli

func NewCli(
	stdIn io.Reader,
	stdOut io.Writer,
	stdErr io.Writer,
	colors bool,
	definitionProvider DefinitionProvider,
	configProvider config.ConfigProvider,
	executor executor.Executor,
	pluginExecutor executor.Executor,
) *Cli

func (Cli) Run

func (c Cli) Run(args []string, input utils.Stream) error

type CommandBuilder

type CommandBuilder struct {
	Input              utils.Stream
	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

func (CommandBuilder) VersionFlag

func (b CommandBuilder) VersionFlag(hidden bool) 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

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

type DefinitionData

type DefinitionData struct {
	Name    string
	Version string
	Data    []byte
}

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

func NewDefinitionData

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

type DefinitionFileStore

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

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

func NewDefinitionFileStore

func NewDefinitionFileStore(directory string, embedded embed.FS) *DefinitionFileStore

func NewDefinitionFileStoreWithData

func NewDefinitionFileStoreWithData(data []DefinitionData) *DefinitionFileStore

func (*DefinitionFileStore) Names

func (s *DefinitionFileStore) Names(version string) ([]string, error)

func (*DefinitionFileStore) Read

func (s *DefinitionFileStore) Read(name string, version string) (*DefinitionData, error)

type DefinitionProvider

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

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 NewDefinitionProvider

func NewDefinitionProvider(store DefinitionStore, parser parser.Parser, commandPlugins []plugin.CommandPlugin) *DefinitionProvider

func (DefinitionProvider) Index

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

func (DefinitionProvider) Load

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

type DefinitionStore

type DefinitionStore interface {
	Names(version string) ([]string, error)
	Read(name string, version string) (*DefinitionData, error)
}

DefinitionStore is used to provide the names and content of definition files.

type UriBuilder

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

func NewUriBuilder(uri url.URL) *UriBuilder

func (*UriBuilder) OverrideUri

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

func (UriBuilder) Uri

func (b UriBuilder) Uri() url.URL

Jump to

Keyboard shortcuts

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