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.
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.
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.
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.
Index ¶
- func InitRunner(builder func() CommandRunner)
- type BashScript
- type CMDRunnerOptions
- type Command
- type CommandRunner
- type CreateFileOptions
- type DockerBuildOptions
- type DockerComposeDownOptions
- type DockerComposeLogsOptions
- type DockerComposePsOptions
- type DockerComposeUpOptions
- type DockerInspectOptions
- type DockerPSOptions
- type EchoToFileOptions
- type UnixCMDRunner
- func (cr *UnixCMDRunner) BuildCreateFileCMD(options CreateFileOptions) Command
- func (cr *UnixCMDRunner) BuildDockerBuildCMD(options DockerBuildOptions) Command
- func (cr *UnixCMDRunner) BuildDockerComposeDownCMD(options DockerComposeDownOptions) Command
- func (cr *UnixCMDRunner) BuildDockerComposeLogsCMD(options DockerComposeLogsOptions) Command
- func (cr *UnixCMDRunner) BuildDockerComposePSCMD(options DockerComposePsOptions) Command
- func (cr *UnixCMDRunner) BuildDockerComposeUpCMD(options DockerComposeUpOptions) Command
- func (cr *UnixCMDRunner) BuildDockerInspectCMD(options DockerInspectOptions) Command
- func (cr *UnixCMDRunner) BuildDockerPSCMD(options DockerPSOptions) Command
- func (cr *UnixCMDRunner) BuildDockerPullCMD(options DockerBuildOptions) Command
- func (cr *UnixCMDRunner) BuildEchoToFileCMD(options EchoToFileOptions) Command
- func (cr *UnixCMDRunner) RunBash(script BashScript) (string, error)
- func (cr *UnixCMDRunner) RunCMD(cmd Command) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitRunner ¶
func InitRunner(builder func() CommandRunner)
Types ¶
type BashScript ¶
type BashScript struct {
// Tmp : script template
Tmp *template.Template
// getOutput : get output of the script
GetOutput bool
// Data: template data object
Data interface{}
}
BashScript : Represents a script to be executed
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
// RunInPty : run command in a pty
RunInPty bool
}
Command : Represents a command
type CommandRunner ¶
type CommandRunner interface {
BuildDockerComposeUpCMD(options DockerComposeUpOptions) Command
BuildDockerPSCMD(options DockerPSOptions) Command
BuildDockerComposePSCMD(options DockerComposePsOptions) Command
BuildDockerComposeLogsCMD(options DockerComposeLogsOptions) 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
RunCMD(cmd Command) (string, error)
RunBash(script BashScript) (string, error)
}
var Runner CommandRunner
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
}
DockerBuildOptions : Represents docker build 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 --quietto 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 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 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) 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) BuildDockerComposeUpCMD ¶
func (cr *UnixCMDRunner) BuildDockerComposeUpCMD(options DockerComposeUpOptions) 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) RunBash ¶
func (cr *UnixCMDRunner) RunBash(script BashScript) (string, error)