blcli

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2021 License: Apache-2.0 Imports: 19 Imported by: 0

README

bl-cli

Build Status GoDoc Go Report Card

bl is a command line interface (CLI) for the BinaryLane API.

Usage:
  bl [command]

Available Commands:
  account         Display commands that retrieve account details
  auth            Display commands for authenticating bl with an account
  balance         Display commands for retrieving your account balance
  billing-history Display commands for retrieving your billing history
  completion      Modify your shell so bl commands autocomplete with TAB
  compute         Display commands that manage infrastructure
  help            Help about any command
  invoice         Display commands for retrieving invoices for your account
  projects        Manage projects and assign resources to them
  version         Show the current version
  vpcs            Display commands that manage VPCs

Flags:
  -t, --access-token string   API V2 access token
  -u, --api-url string        Override default API endpoint
  -c, --config string         Specify a custom config file (default "$HOME/.config/bl/config.yaml")
      --context string        Specify a custom authentication context name
  -h, --help                  help for bl
  -o, --output string         Desired output format [text|json] (default "text")
      --trace                 Show a log of network activity while performing a command

Use "bl [command] --help" for more information about a command.

See the full reference documentation for information about each available command.

Installing bl-cli

Downloading a Release from GitHub

Visit the Releases page for the bl-cli GitHub project, and find the appropriate archive for your operating system and architecture. Download the archive from your browser or copy its URL and retrieve it to your home directory with wget or curl.

For example, with wget:

cd ~
wget https://github.com/binarylane/bl-cli/releases/download/v<version>/bl-cli-<version>-linux-amd64.tar.gz

Or with curl:

cd ~
curl -OL https://github.com/binarylane/bl-cli/releases/download/v<version>/bl-cli-<version>-linux-amd64.tar.gz

Extract the binary:

tar xf ~/bl-cli-<version>-linux-amd64.tar.gz

Or download and extract with this oneliner:

curl -sL https://github.com/binarylane/bl-cli/releases/download/v<version>/bl-cli-<version>-linux-amd64.tar.gz | tar -xzv

where <version> is the full semantic version, e.g., 0.1.0.

On Windows systems, you should be able to double-click the zip archive to extract the bl-cli executable.

Move the bl binary to somewhere in your path. For example, on GNU/Linux and OS X systems:

sudo mv ~/bl /usr/local/bin

Windows users can follow How to: Add Tool Locations to the PATH Environment Variable in order to add bl to their PATH.

Building with Docker

If you have Docker configured, you can build a local Docker image using bl-cli's Dockerfile and run bl-cli within a container.

docker build --tag=bl-cli .

Then you can run it within a container.

docker run --rm --interactive --tty --env=BINARYLANE_ACCESS_TOKEN="your_BL_token" bl any_command

Building the Development Version from Source

If you have a Go environment configured, you can install the development version of bl-cli from the command line.

go get github.com/binarylane/bl-cli/cmd/bl

While the development version is a good way to take a peek at bl-cli's latest features before they get released, be aware that it may have bugs. Officially released versions will generally be more stable.

Dependencies

bl-cli uses Go modules with vendoring.

Authenticating with BinaryLane

To use bl-cli, you need to authenticate with BinaryLane by providing an access token, which can be created from the Developer API section of the Control Panel.

Docker users will have to use the BINARYLANE_ACCESS_TOKEN environmental variable to authenticate, as explained in the Installation section of this document.

If you're not using Docker to run bl-cli, authenticate with the auth init command.

bl auth init

You will be prompted to enter the BinaryLane access token that you generated in the BinaryLane control panel.

BinaryLane access token: your_access_token

After entering your token, you will receive confirmation that the credentials were accepted. If the token doesn't validate, make sure you copied and pasted it correctly.

Validating token: OK

This will create the necessary directory structure and configuration file to store your credentials.

Logging into multiple BinaryLane accounts

bl-cli allows you to log in to multiple BinaryLane accounts at the same time and easily switch between them with the use of authentication contexts.

By default, a context named default is used. To create a new context, run bl auth init --context <new-context-name>. You may also pass the new context's name using the BINARYLANE_CONTEXT environment variable. You will be prompted for your API access token which will be associated with the new context.

To use a non-default context, pass the context name to any bl command. For example:

bl compute server list --context <new-context-name>

To set a new default context, run bl auth switch --context <new-context-name>. This command will save the current context to the config file and use it for all commands by default if a context is not specified.

The --access-token flag or BINARYLANE_ACCESS_TOKEN variable are acknowledged only if the default context is used. Otherwise, they will have no effect on what API access token is used. To temporarily override the access token if a different context is set as default, use bl --context default --access-token your_access_token ....

Configuring Default Values

The bl-cli configuration file is used to store your API Access Token as well as the defaults for command flags. If you find yourself using certain flags frequently, you can change their default values to avoid typing them every time. This can be useful when, for example, you want to change the username or port used for SSH.

On OS X, bl-cli saves its configuration as ${HOME}/Library/Application Support/bl/config.yaml. The ${HOME}/Library/Application Support/bl/ directory will be created once you run bl auth init.

On Linux, bl-cli saves its configuration as ${XDG_CONFIG_HOME}/bl/config.yaml if the ${XDG_CONFIG_HOME} environmental variable is set, or ~/.config/bl/config.yaml if it is not. On Windows, the config file location is %APPDATA%\bl\config.yaml.

The configuration file is automatically created and populated with default properties when you authenticate with bl-cli for the first time. The typical format for a property is category.command.sub-command.flag: value. For example, the property for the force flag with tag deletion is tag.delete.force.

To change the default SSH user used when connecting to a server with bl-cli, look for the compute.ssh.ssh-user property and change the value after the colon. In this example, we changed it to the username admin.

. . .
compute.ssh.ssh-user: admin
. . .

Save and close the file. The next time you use bl-cli, the new default values you set will be in effect. In this example, that means that it will SSH as the admin user (instead of the default root user) next time you log into a server.

Enabling Shell Auto-Completion

bl-cli also has auto-completion support. It can be set up so that if you partially type a command and then press TAB, the rest of the command is automatically filled in. For example, if you type bl comp<TAB><TAB> ser<TAB><TAB> with auto-completion enabled, you'll see bl-cli compute server appear on your command prompt.

Note: Shell auto-completion is not available for Windows users.

bl-cli can generate an auto-completion script with the bl completion your_shell_here command. Valid arguments for the shell are Bash (bash) and ZSH (zsh). By default, the script will be printed to the command line output. For more usage examples for the completion command, use bl completion --help.

Linux Auto Completion

The most common way to use the completion command is by adding a line to your local profile configuration. At the end of your ~/.profile file, add this line:

source <(bl completion your_shell_here)

Then refresh your profile.

source ~/.profile

MacOS

macOS users will have to install the bash-completion framework to use the auto-completion feature.

brew install bash-completion

After it's installed, load bash_completion by adding the following line to your .profile or .bashrc/.zshrc file.

source $(brew --prefix)/etc/bash_completion

Then refresh your profile using the appropriate command for the bash configurations file.

source ~/.profile
source ~/.bashrc
source ~/.zshrc

Examples

bl-cli is able to interact with all of your BinaryLane resources. Below are a few common usage examples.

  • List all servers on your account:
bl compute server list
  • Create a server:
bl compute server create <name> --region <region-slug> --image <image-slug> --size <size-slug>
  • Create a new A record for an existing domain:
bl compute domain records create --record-type A --record-name www --record-data <ip-addr> <domain-name>

bl-cli also simplifies actions without an API endpoint. For instance, it allows you to SSH to your server by name:

bl compute ssh <server-name>

By default, it assumes you are using the root user. If you want to SSH as a specific user, you can do that as well:

bl compute ssh <user>@<server-name>

Documentation

Index

Constants

View Source
const (
	// ArgAccessToken is the access token to be used for the operations
	ArgAccessToken = "access-token"
	// ArgContext is the name of the auth context
	ArgContext = "context"
	// ArgDefaultContext is the default auth context
	ArgDefaultContext = "default"
	// ArgActionID is an action id argument.
	ArgActionID = "action-id"
	// ArgActionAfter is an action after argument.
	ArgActionAfter = "after"
	// ArgActionBefore is an action before argument.
	ArgActionBefore = "before"
	// ArgActionResourceType is an action resource type argument.
	ArgActionResourceType = "resource-type"
	// ArgActionRegion is an action region argument.
	ArgActionRegion = "region"
	// ArgActionStatus is an action status argument.
	ArgActionStatus = "status"
	// ArgActionType is an action type argument.
	ArgActionType = "action-type"
	// ArgAppSpec is a path to an app spec.
	ArgAppSpec = "spec"
	// ArgAppLogType the type of log.
	ArgAppLogType = "type"
	// ArgVPCID is a VPC ID argument.
	ArgVPCID = "vpc-id"
	// ArgCommandWait is a wait for a resource to be created argument.
	ArgCommandWait = "wait"
	// ArgServerID is a server id argument.
	ArgServerID = "server-id"
	// ArgServerIDs is a list of server IDs.
	ArgServerIDs = "server-ids"
	// ArgKernelID is a kernel id argument.
	ArgKernelID = "kernel-id"
	// ArgImage is an image argument.
	ArgImage = "image"
	// ArgImageID is an image id argument.
	ArgImageID = "image-id"
	// ArgImagePublic is a public image argument.
	ArgImagePublic = "public"
	// ArgImageSlug is an image slug argment.
	ArgImageSlug = "image-slug"
	// ArgIPAddress is an IP address argument.
	ArgIPAddress = "ip-address"
	// ArgServerName is a server name argument.
	ArgServerName = "server-name"
	// ArgResizeDisk is a resize disk argument.
	ArgResizeDisk = "resize-disk"
	// ArgSnapshotName is a snapshot name argument.
	ArgSnapshotName = "snapshot-name"
	// ArgSnapshotDesc is the description for volume snapshot.
	ArgSnapshotDesc = "snapshot-desc"
	// ArgResourceType is the resource type for snapshot.
	ArgResourceType = "resource"
	// ArgBackups is an enable backups argument.
	ArgBackups = "enable-backups"
	// ArgIPv6 is an enable IPv6 argument.
	ArgIPv6 = "enable-ipv6"
	// ArgPrivateNetworking is an enable private networking argument.
	ArgPrivateNetworking = "enable-private-networking"
	// ArgMonitoring is an enable monitoring argument.
	ArgMonitoring = "enable-monitoring"
	// ArgRecordData is a record data argument.
	ArgRecordData = "record-data"
	// ArgRecordID is a record id argument.
	ArgRecordID = "record-id"
	// ArgRecordName is a record name argument.
	ArgRecordName = "record-name"
	// ArgRecordPort is a record port argument.
	ArgRecordPort = "record-port"
	// ArgRecordPriority is a record priority argument.
	ArgRecordPriority = "record-priority"
	// ArgRecordType is a record type argument.
	ArgRecordType = "record-type"
	// ArgRecordTTL is a record ttl argument.
	ArgRecordTTL = "record-ttl"
	// ArgRecordWeight is a record weight argument.
	ArgRecordWeight = "record-weight"
	// ArgRecordFlags is a record flags argument.
	ArgRecordFlags = "record-flags"
	// ArgRecordTag is a record tag argument.
	ArgRecordTag = "record-tag"
	// ArgRegionSlug is a region slug argument.
	ArgRegionSlug = "region"
	// ArgSizeSlug is a size slug argument.
	ArgSizeSlug = "size"
	// ArgsSSHKeyPath is a ssh argument.
	ArgsSSHKeyPath = "ssh-key-path"
	// ArgSSHKeys is a ssh key argument.
	ArgSSHKeys = "ssh-keys"
	// ArgsSSHPort is a ssh argument.
	ArgsSSHPort = "ssh-port"
	// ArgsSSHAgentForwarding is a ssh argument.
	ArgsSSHAgentForwarding = "ssh-agent-forwarding"
	// ArgsSSHPrivateIP is a ssh argument.
	ArgsSSHPrivateIP = "ssh-private-ip"
	// ArgSSHCommand is a ssh argument.
	ArgSSHCommand = "ssh-command"
	// ArgUserData is a user data argument.
	ArgUserData = "user-data"
	// ArgUserDataFile is a user data file location argument.
	ArgUserDataFile = "user-data-file"
	// ArgImageName name is an image name argument.
	ArgImageName = "image-name"
	// ArgImageExternalURL is a URL that returns an image file.
	ArgImageExternalURL = "image-url"
	// ArgImageDistro is the name of a custom image's distribution
	ArgImageDistro = "image-distribution"
	// ArgImageDescription is free text that describes the image.
	ArgImageDescription = "image-description"
	// ArgKey is a key argument.
	ArgKey = "key"
	// ArgKeyName is a key name argument.
	ArgKeyName = "key-name"
	// ArgKeyPublicKey is a public key argument.
	ArgKeyPublicKey = "public-key"
	// ArgKeyPublicKeyFile is a public key file argument.
	ArgKeyPublicKeyFile = "public-key-file"
	// ArgSSHUser is a SSH user argument.
	ArgSSHUser = "ssh-user"
	// ArgFormat is columns to include in output argment.
	ArgFormat = "format"
	// ArgNoHeader hides the output header.
	ArgNoHeader = "no-header"
	// ArgPollTime is how long before the next poll argument.
	ArgPollTime = "poll-timeout"
	// ArgTagName is a tag name
	// NOTE: ArgTagName will be deprecated once existing uses have been migrated
	// to use `--tag` (ArgTag). ArgTagName should not be used on new calls.
	ArgTagName = "tag-name"
	// ArgTagNames is a slice of possible tag names
	// NOTE: ArgTagNames will be deprecated once existing uses have been migrated
	// to use `--tag` (ArgTag). ArgTagNames should not be used on new calls.
	ArgTagNames = "tag-names"
	// ArgTag specifies tag.  --tag can be repeated or multiple tags can be , separated.
	ArgTag = "tag"
	//ArgTemplate is template format
	ArgTemplate = "template"
	// ArgVersion is the version of the command to use
	ArgVersion = "version"

	// ArgOutput is an output type argument.
	ArgOutput = "output"

	// ArgVolumeSize is the size of a volume.
	ArgVolumeSize = "size"
	// ArgVolumeDesc is the description of a volume.
	ArgVolumeDesc = "desc"
	// ArgVolumeRegion is the region of a volume.
	ArgVolumeRegion = "region"
	// ArgVolumeSnapshot is the snapshot from which to create a volume.
	ArgVolumeSnapshot = "snapshot"
	// ArgVolumeFilesystemType is the filesystem type for a volume.
	ArgVolumeFilesystemType = "fs-type"
	// ArgVolumeFilesystemLabel is the filesystem label for a volume.
	ArgVolumeFilesystemLabel = "fs-label"
	// ArgVolumeList is the IDs of many volumes.
	ArgVolumeList = "volumes"

	// ArgCDNTTL is a cdn ttl argument
	ArgCDNTTL = "ttl"
	// ArgCDNDomain is a cdn custom domain argument
	ArgCDNDomain = "domain"
	// ArgCDNCertificateID is a certificate id to use with a custom domain
	ArgCDNCertificateID = "certificate-id"
	// ArgCDNFiles is a cdn files argument
	ArgCDNFiles = "files"

	// ArgCertificateName is a name of the certificate.
	ArgCertificateName = "name"
	// ArgCertificateDNSNames is a list of DNS names.
	ArgCertificateDNSNames = "dns-names"
	// ArgPrivateKeyPath is a path to a private key for the certificate.
	ArgPrivateKeyPath = "private-key-path"
	// ArgLeafCertificatePath is a path to a certificate leaf.
	ArgLeafCertificatePath = "leaf-certificate-path"
	// ArgCertificateChainPath is a path to a certificate chain.
	ArgCertificateChainPath = "certificate-chain-path"
	// ArgCertificateType is a certificate type.
	ArgCertificateType = "type"

	// ArgLoadBalancerName is a name of the load balancer.
	ArgLoadBalancerName = "name"
	// ArgLoadBalancerAlgorithm is a load balancing algorithm.
	ArgLoadBalancerAlgorithm = "algorithm"
	// ArgRedirectHTTPToHTTPS is a flag that indicates whether HTTP requests to the load balancer on port 80 should be redirected to HTTPS on port 443.
	ArgRedirectHTTPToHTTPS = "redirect-http-to-https"
	// ArgEnableProxyProtocol is a flag that indicates whether PROXY protocol should be enabled on the load balancer.
	ArgEnableProxyProtocol = "enable-proxy-protocol"
	// ArgEnableBackendKeepalive is a flag that indicates whether keepalive connections should be enabled to target servers from the load balancer.
	ArgEnableBackendKeepalive = "enable-backend-keepalive"
	// ArgStickySessions is a list of sticky sessions settings for the load balancer.
	ArgStickySessions = "sticky-sessions"
	// ArgHealthCheck is a list of health check settings for the load balancer.
	ArgHealthCheck = "health-check"
	// ArgForwardingRules is a list of forwarding rules for the load balancer.
	ArgForwardingRules = "forwarding-rules"

	// ArgFirewallName is a name of the firewall.
	ArgFirewallName = "name"
	// ArgInboundRules is a list of inbound rules for the firewall.
	ArgInboundRules = "inbound-rules"
	// ArgOutboundRules is a list of outbound rules for the firewall.
	ArgOutboundRules = "outbound-rules"

	// ArgProjectName is the name of a project.
	ArgProjectName = "name"
	// ArgProjectDescription is the description of a project.
	ArgProjectDescription = "description"
	// ArgProjectPurpose is the purpose of a project.
	ArgProjectPurpose = "purpose"
	// ArgProjectEnvironment is the environment of a project. Should be one of 'Development', 'Staging', 'Production'.
	ArgProjectEnvironment = "environment"
	// ArgProjectIsDefault is used to change the default project.
	ArgProjectIsDefault = "is_default"
	// ArgProjectResource is a flag for your resource URNs
	ArgProjectResource = "resource"

	// ArgDatabaseEngine is a flag for specifying which database engine to use
	ArgDatabaseEngine = "engine"
	// ArgDatabaseNumNodes is the number of nodes in the database cluster
	ArgDatabaseNumNodes = "num-nodes"
	// ArgDatabaseMaintenanceDay is the new day for the maintenance window
	ArgDatabaseMaintenanceDay = "day"
	// ArgDatabaseMaintenanceHour is the new hour for the maintenance window
	ArgDatabaseMaintenanceHour = "hour"
	// ArgDatabasePoolUserName is the name of user for use with connection pool
	ArgDatabasePoolUserName = "user"
	// ArgDatabasePoolDBName is the database for use with connection pool
	ArgDatabasePoolDBName = "db"
	// ArgDatabasePoolSize is the flag for connection pool size
	ArgDatabasePoolSize = "size"
	// ArgDatabasePoolMode is the flag for connection pool mode
	ArgDatabasePoolMode = "mode"
	// ArgDatabaseUserMySQLAuthPlugin is a flag for setting the MySQL user auth plugin
	ArgDatabaseUserMySQLAuthPlugin = "mysql-auth-plugin"

	// ArgPrivateNetworkUUID is the flag for VPC UUID
	ArgPrivateNetworkUUID = "private-network-uuid"

	// ArgForce forces confirmation on actions
	ArgForce = "force"

	// ArgObjectName is the Kubernetes object name
	ArgObjectName = "name"
	// ArgObjectNamespace is the Kubernetes object namespace
	ArgObjectNamespace = "namespace"

	// ArgVPCName is a name of the VPC.
	ArgVPCName = "name"
	// ArgVPCDescription is a VPC description.
	ArgVPCDescription = "description"
	// ArgVPCDefault is the VPC default argument, to update a specific VPC to the default VPC.
	ArgVPCDefault = "default"
	// ArgVPCIPRange is a VPC range of IP addresses in CIDR notation.
	ArgVPCIPRange = "ip-range"

	// ArgReadWrite indicates a generated token should be read/write.
	ArgReadWrite = "read-write"
	// ArgRegistryExpirySeconds indicates the length of time the token will be valid in seconds.
	ArgRegistryExpirySeconds = "expiry-seconds"
)
View Source
const (
	// ArgShortForce forces confirmation on actions
	ArgShortForce = "f"
)
View Source
const (
	// LatestReleaseURL is the latest release URL endpoint.
	LatestReleaseURL = "https://api.github.com/repos/binarylane/bl-cli/releases/latest"
)

Variables

View Source
var (
	// Build is set at build time. It defines the git SHA for the current build.
	Build string

	// Major is set at build time. It defines the major semantic version of bl.
	Major string

	// Minor is set at build time. It defines the minor semantic version of bl.
	Minor string

	// Patch is set at build time. It defines the patch semantic version of bl.
	Patch string

	// Label is set at build time. It defines the string that comes after the
	// version of bl, ie, the "dev" in v1.0.0-dev.
	Label string

	// DoitVersion is bl's version.
	DoitVersion Version

	// TraceHTTP traces http connections.
	TraceHTTP bool
)

Functions

func CommandName

func CommandName() string

CommandName returns the name by which bl was invoked

Types

type Config

type Config interface {
	GetClient(trace bool, accessToken string) (*binarylane.Client, error)
	SSH(user, host, keyPath string, port int, opts ssh.Options) runner.Runner
	Set(ns, key string, val interface{})
	IsSet(key string) bool
	GetString(ns, key string) (string, error)
	GetBool(ns, key string) (bool, error)
	GetBoolPtr(ns, key string) (*bool, error)
	GetInt(ns, key string) (int, error)
	GetIntPtr(ns, key string) (*int, error)
	GetStringSlice(ns, key string) ([]string, error)
	GetStringMapString(ns, key string) (map[string]string, error)
}

Config is an interface that represent doit's config.

type GithubLatestVersioner

type GithubLatestVersioner struct{}

GithubLatestVersioner retrieves the latest version from Github.

func (*GithubLatestVersioner) LatestVersion

func (glv *GithubLatestVersioner) LatestVersion() (string, error)

LatestVersion retrieves the latest version from Github or returns an error.

type LatestVersioner

type LatestVersioner interface {
	LatestVersion() (string, error)
}

LatestVersioner an interface for detecting the latest version.

type LiveConfig

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

LiveConfig is an implementation of Config for live values.

func (*LiveConfig) GetBool

func (c *LiveConfig) GetBool(ns, key string) (bool, error)

GetBool returns a config value as a bool.

func (*LiveConfig) GetBoolPtr

func (c *LiveConfig) GetBoolPtr(ns, key string) (*bool, error)

GetBoolPtr returns a config value as a bool pointer.

func (*LiveConfig) GetClient

func (c *LiveConfig) GetClient(trace bool, accessToken string) (*binarylane.Client, error)

GetClient returns a binarylane.Client.

func (*LiveConfig) GetInt

func (c *LiveConfig) GetInt(ns, key string) (int, error)

GetInt returns a config value as an int.

func (*LiveConfig) GetIntPtr

func (c *LiveConfig) GetIntPtr(ns, key string) (*int, error)

GetIntPtr returns a config value as an int pointer.

func (*LiveConfig) GetString

func (c *LiveConfig) GetString(ns, key string) (string, error)

GetString returns a config value as a string.

func (*LiveConfig) GetStringMapString

func (c *LiveConfig) GetStringMapString(ns, key string) (map[string]string, error)

GetStringMapString returns a config value as a string to string map.

func (*LiveConfig) GetStringSlice

func (c *LiveConfig) GetStringSlice(ns, key string) ([]string, error)

GetStringSlice returns a config value as a string slice.

func (*LiveConfig) IsSet

func (c *LiveConfig) IsSet(key string) bool

IsSet checks if a config is set

func (*LiveConfig) SSH

func (c *LiveConfig) SSH(user, host, keyPath string, port int, opts ssh.Options) runner.Runner

SSH creates a ssh connection to a host.

func (*LiveConfig) Set

func (c *LiveConfig) Set(ns, key string, val interface{})

Set sets a config key.

type MissingArgsErr

type MissingArgsErr struct {
	Command string
}

MissingArgsErr is returned when there are too few arguments for a command.

func NewMissingArgsErr

func NewMissingArgsErr(cmd string) *MissingArgsErr

NewMissingArgsErr creates a MissingArgsErr instance.

func (*MissingArgsErr) Error

func (e *MissingArgsErr) Error() string

type MockRunner

type MockRunner struct {
	Err error
}

MockRunner is an implemenation of Runner for mocking.

func (*MockRunner) Run

func (tr *MockRunner) Run() error

Run mock runs things.

type TestConfig

type TestConfig struct {
	SSHFn func(user, host, keyPath string, port int, opts ssh.Options) runner.Runner

	IsSetMap map[string]bool
	// contains filtered or unexported fields
}

TestConfig is an implementation of Config for testing.

func NewTestConfig

func NewTestConfig() *TestConfig

NewTestConfig creates a new, ready-to-use instance of a TestConfig.

func (*TestConfig) GetBool

func (c *TestConfig) GetBool(ns, key string) (bool, error)

GetBool returns the bool value for the key in the given namespace. Because this is a mock implementation, and error will never be returned.

func (*TestConfig) GetBoolPtr

func (c *TestConfig) GetBoolPtr(ns, key string) (*bool, error)

GetBoolPtr returns the bool value for the key in the given namespace. Because this is a mock implementation, and error will never be returned.

func (*TestConfig) GetClient

func (c *TestConfig) GetClient(trace bool, accessToken string) (*binarylane.Client, error)

GetClient mocks a GetClient call. The returned binarylane client will be nil.

func (*TestConfig) GetInt

func (c *TestConfig) GetInt(ns, key string) (int, error)

GetInt returns the int value for the key in the given namespace. Because this is a mock implementation, and error will never be returned.

func (*TestConfig) GetIntPtr

func (c *TestConfig) GetIntPtr(ns, key string) (*int, error)

GetIntPtr returns the int value for the key in the given namespace. Because this is a mock implementation, and error will never be returned.

func (*TestConfig) GetString

func (c *TestConfig) GetString(ns, key string) (string, error)

GetString returns the string value for the key in the given namespace. Because this is a mock implementation, and error will never be returned.

func (*TestConfig) GetStringMapString

func (c *TestConfig) GetStringMapString(ns, key string) (map[string]string, error)

GetStringMapString returns the string-to-string value for the key in the given namespace. Because this is a mock implementation, and error will never be returned.

func (*TestConfig) GetStringSlice

func (c *TestConfig) GetStringSlice(ns, key string) ([]string, error)

GetStringSlice returns the string slice value for the key in the given namespace. Because this is a mock implementation, and error will never be returned.

func (*TestConfig) IsSet

func (c *TestConfig) IsSet(key string) bool

IsSet returns true if the given key is set on the config.

func (*TestConfig) SSH

func (c *TestConfig) SSH(user, host, keyPath string, port int, opts ssh.Options) runner.Runner

SSH returns a mock SSH runner.

func (*TestConfig) Set

func (c *TestConfig) Set(ns, key string, val interface{})

Set sets a config key.

type TooManyArgsErr

type TooManyArgsErr struct {
	Command string
}

TooManyArgsErr is returned when there are too many arguments for a command.

func NewTooManyArgsErr

func NewTooManyArgsErr(cmd string) *TooManyArgsErr

NewTooManyArgsErr creates a TooManyArgsErr instance.

func (*TooManyArgsErr) Error

func (e *TooManyArgsErr) Error() string

type Version

type Version struct {
	Major, Minor, Patch int
	Name, Build, Label  string
}

Version is the version info for doit.

func (Version) Complete

func (v Version) Complete(lv LatestVersioner) string

Complete is the complete version for doit.

func (Version) String

func (v Version) String() string

Directories

Path Synopsis
bl
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
cmd
bl
pkg
ssh

Jump to

Keyboard shortcuts

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