commands

package
v1.7.2 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Copyright 2022 Nethermind

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CMDRunnerOptions

type CMDRunnerOptions struct {
	// RunAsAdmin : True to run commands as admin
	RunAsAdmin bool
}

CMDRunnerOptions : Options for configuring a commands runner

type Command

type Command struct {
	// Cmd : command string
	Cmd string
	// GetOutput : get output of command
	GetOutput bool
	// ForceNoSudo : force the command to not be run with sudo
	ForceNoSudo bool
	// IgnoreTerminal : command can be executed without using a terminal, useful for windows
	IgnoreTerminal bool
}

Command : Represents a command

type CommandRunner

type CommandRunner interface {
	BuildDockerComposeUpCMD(options DockerComposeUpOptions) Command

	BuildDockerComposePullCMD(options DockerComposePullOptions) Command

	BuildDockerComposeCreateCMD(options DockerComposeCreateOptions) Command

	BuildDockerComposeBuildCMD(options DockerComposeBuildOptions) Command

	BuildDockerPSCMD(options DockerPSOptions) Command

	BuildDockerComposePSCMD(options DockerComposePsOptions) Command

	BuildDockerComposeLogsCMD(options DockerComposeLogsOptions) Command

	BuildDockerComposeVersionCMD() Command

	BuildDockerBuildCMD(options DockerBuildOptions) Command

	BuildDockerPullCMD(options DockerBuildOptions) Command

	BuildDockerInspectCMD(options DockerInspectOptions) Command

	BuildDockerComposeDownCMD(options DockerComposeDownOptions) Command

	BuildCreateFileCMD(options CreateFileOptions) Command

	BuildEchoToFileCMD(options EchoToFileOptions) Command

	BuildOpenTextEditor(options OpenTextEditorOptions) Command

	RunCMD(cmd Command) (string, int, error)

	RunScript(script ScriptFile) (string, error)
}

func NewCMDRunner

func NewCMDRunner(options CMDRunnerOptions) CommandRunner

type CreateFileOptions added in v0.4.0

type CreateFileOptions struct {
	// FileName : path to file
	FileName string
}

CreateFileOptions : Represents create file command options

type DockerBuildOptions

type DockerBuildOptions struct {
	// Path : path to dockerfile
	Path string
	// Tag : docker build --tag tag
	Tag string
	// Args : docker --build-arg tags
	Args map[string]string
}

DockerBuildOptions : Represents docker build command options

type DockerComposeBuildOptions added in v1.0.0

type DockerComposeBuildOptions struct {
	// Path to the docker-compose.yaml
	Path string
	// Services names
	Services []string
}

DockerComposeBuildOptions represents `docker compose build` command options

type DockerComposeCreateOptions added in v1.0.0

type DockerComposeCreateOptions struct {
	// Path to the docker-compose.yaml
	Path string
	// Services names
	Services []string
}

DockerComposeCreateOptions represents `docker compose create` command options

type DockerComposeDownOptions

type DockerComposeDownOptions struct {
	// Path : path to docker-compose.yaml
	Path string
}

DockerComposeDownOptions : Represents docker compose down command options

type DockerComposeLogsOptions

type DockerComposeLogsOptions struct {
	// Path : path to docker-compose.yaml
	Path string
	// Services : services names
	Services []string
	// Follow : use with --follow
	Follow bool
	// Tail : if greater than 0 and Follow is False used for --tail
	Tail int
}

DockerComposeLogsOptions : Represents docker compose log command options

type DockerComposePsOptions

type DockerComposePsOptions struct {
	// Path : path to docker-compose.yaml
	Path string
	// Services : use with --services to display services
	Services bool
	// Quiet : use with --quiet to display only IDs
	Quiet bool
	// ServiceName: Service argument
	ServiceName string
	// FilterRunning : use with --filter status=running
	FilterRunning bool
}

DockerComposePsOptions : Represents docker compose ps command options

type DockerComposePullOptions added in v0.5.0

type DockerComposePullOptions struct {
	// Path to the docker-compose.yaml
	Path string
	// Services names
	Services []string
}

DockerComposePullOptions represents 'docker compose pull' command options

type DockerComposeUpOptions

type DockerComposeUpOptions struct {
	// Path : path to docker-compose.yaml
	Path string
	// Services : services names
	Services []string
}

DockerComposeUpOptions : Represent docker compose up command options

type DockerInspectOptions

type DockerInspectOptions struct {
	// Name : docker object name
	Name string
	// Format : Go template for --format flag
	Format string
}

DockerInspectOptions : Represents docker inspect command options

type DockerPSOptions

type DockerPSOptions struct {
	// All : use with --all
	All bool
}

DockerPSOptions : Represent docker ps command options

type EchoToFileOptions added in v0.4.0

type EchoToFileOptions struct {
	// FileName : path to file
	FileName string
	// Content : content to be written to file
	Content string
}

EchoToFileOptions : Represents echo to file command options

type OpenTextEditorOptions added in v1.0.0

type OpenTextEditorOptions struct {
	// FilePath path to the file to open
	FilePath string
}

OpenTextEditorOptions represents options to open file in a text editor

type ScriptFile added in v0.6.0

type ScriptFile struct {
	// Tmp : script template
	Tmp *template.Template
	// getOutput : get output of the script
	GetOutput bool
	// Data: template data object
	Data interface{}
}

ScriptFile : Represents a bash or bat script to be executed

type UnixCMDRunner

type UnixCMDRunner struct {
	RunWithSudo bool
}

func (*UnixCMDRunner) BuildCreateFileCMD added in v0.4.0

func (cr *UnixCMDRunner) BuildCreateFileCMD(options CreateFileOptions) Command

func (*UnixCMDRunner) BuildDockerBuildCMD

func (cr *UnixCMDRunner) BuildDockerBuildCMD(options DockerBuildOptions) Command

func (*UnixCMDRunner) BuildDockerComposeBuildCMD added in v1.0.0

func (cr *UnixCMDRunner) BuildDockerComposeBuildCMD(options DockerComposeBuildOptions) Command

func (*UnixCMDRunner) BuildDockerComposeCreateCMD added in v1.0.0

func (cr *UnixCMDRunner) BuildDockerComposeCreateCMD(options DockerComposeCreateOptions) Command

func (*UnixCMDRunner) BuildDockerComposeDownCMD

func (cr *UnixCMDRunner) BuildDockerComposeDownCMD(options DockerComposeDownOptions) Command

func (*UnixCMDRunner) BuildDockerComposeLogsCMD

func (cr *UnixCMDRunner) BuildDockerComposeLogsCMD(options DockerComposeLogsOptions) Command

func (*UnixCMDRunner) BuildDockerComposePSCMD

func (cr *UnixCMDRunner) BuildDockerComposePSCMD(options DockerComposePsOptions) Command

func (*UnixCMDRunner) BuildDockerComposePullCMD added in v0.5.0

func (cr *UnixCMDRunner) BuildDockerComposePullCMD(options DockerComposePullOptions) Command

func (*UnixCMDRunner) BuildDockerComposeUpCMD

func (cr *UnixCMDRunner) BuildDockerComposeUpCMD(options DockerComposeUpOptions) Command

func (*UnixCMDRunner) BuildDockerComposeVersionCMD added in v1.0.0

func (cr *UnixCMDRunner) BuildDockerComposeVersionCMD() Command

func (*UnixCMDRunner) BuildDockerInspectCMD

func (cr *UnixCMDRunner) BuildDockerInspectCMD(options DockerInspectOptions) Command

func (*UnixCMDRunner) BuildDockerPSCMD

func (cr *UnixCMDRunner) BuildDockerPSCMD(options DockerPSOptions) Command

func (*UnixCMDRunner) BuildDockerPullCMD

func (cr *UnixCMDRunner) BuildDockerPullCMD(options DockerBuildOptions) Command

func (*UnixCMDRunner) BuildEchoToFileCMD added in v0.4.0

func (cr *UnixCMDRunner) BuildEchoToFileCMD(options EchoToFileOptions) Command

func (*UnixCMDRunner) BuildOpenTextEditor added in v1.0.0

func (cr *UnixCMDRunner) BuildOpenTextEditor(options OpenTextEditorOptions) Command

func (*UnixCMDRunner) RunCMD

func (cr *UnixCMDRunner) RunCMD(cmd Command) (string, int, error)

func (*UnixCMDRunner) RunScript added in v0.6.0

func (cr *UnixCMDRunner) RunScript(script ScriptFile) (string, error)

Jump to

Keyboard shortcuts

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