wip constructors

This commit is contained in:
2021-05-24 00:11:58 +03:00
parent 8ea717e6a9
commit 6d6bf4f076
4 changed files with 44 additions and 3 deletions

8
internal/cmd/BUILD Normal file
View File

@@ -0,0 +1,8 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = ["cmd.go"],
importpath = "github.com/motiejus/code/undocker/internal/cmd",
visibility = ["//src/undocker:__subpackages__"],
)

20
internal/cmd/cmd.go Normal file
View File

@@ -0,0 +1,20 @@
package cmd
import (
"io"
"os"
)
// BaseCommand provides common fields to all commands.
type BaseCommand struct {
Stdin io.ReadCloser
Stdout io.WriteCloser
Stderr io.WriteCloser
}
// Init initializes BaseCommand with default arguments
func (b *BaseCommand) Init() {
b.Stdin = os.Stdin
b.Stdout = os.Stdout
b.Stderr = os.Stderr
}