diff --git a/src/cmd/internal/internal.go b/src/cmd/internal/internal.go deleted file mode 100644 index c7df58b..0000000 --- a/src/cmd/internal/internal.go +++ /dev/null @@ -1,5 +0,0 @@ -package internal - -// Options represents all command line configurations -type Options struct { -} diff --git a/src/cmd/start/start.go b/src/cmd/run/start.go similarity index 96% rename from src/cmd/start/start.go rename to src/cmd/run/start.go index f46d547..6637f55 100644 --- a/src/cmd/start/start.go +++ b/src/cmd/run/start.go @@ -1,4 +1,4 @@ -package start +package run import ( "context" @@ -17,8 +17,8 @@ func New() *cobra.Command { options := Options{Remove: new(bool)} cmd := &cobra.Command{ - Use: "start", - Short: "Starts container", + Use: "run", + Short: "runs container", Args: cobra.RangeArgs(0, 1), RunE: func(cmd *cobra.Command, args []string) error { name := "" diff --git a/src/internal/shell/shell.go b/src/internal/shell/shell.go deleted file mode 100644 index d8607b8..0000000 --- a/src/internal/shell/shell.go +++ /dev/null @@ -1,35 +0,0 @@ -package shell - -import ( - "os" - "os/exec" - "strings" - - "github.com/silphid/yey/src/internal/logging" -) - -// Execute executes one or multiple shell commands, given specific env vars (defaults to process' env vars if nil) -// and working directory (defaults to process's current work dir if empty string passed) -func Execute(vars []string, dir string, commands ...string) error { - // Env vars default to current process' env vars - if vars == nil { - vars = os.Environ() - } - - // Configure command struct - cmd := &exec.Cmd{ - Path: "/bin/bash", - Args: []string{"/bin/bash", "-c", "set -e; " + strings.Join(commands, "; ")}, - Dir: dir, - Env: vars, - Stdin: os.Stdin, - Stdout: os.Stdout, - Stderr: os.Stderr, - } - - // Execute - logging.Log("Executing command(s) %q in directory %q", commands, dir) - logging.Log("--") - defer logging.Log("--") - return cmd.Run() -} diff --git a/src/main.go b/src/main.go index dd50119..01b8334 100644 --- a/src/main.go +++ b/src/main.go @@ -13,7 +13,7 @@ import ( getcontext "github.com/silphid/yey/src/cmd/get/context" getcontexts "github.com/silphid/yey/src/cmd/get/contexts" - "github.com/silphid/yey/src/cmd/start" + "github.com/silphid/yey/src/cmd/run" "github.com/silphid/yey/src/cmd/versioning" ) @@ -29,7 +29,7 @@ func main() { }() rootCmd := cmd.NewRoot() - rootCmd.AddCommand(start.New()) + rootCmd.AddCommand(run.New()) rootCmd.AddCommand(versioning.New(version)) getCmd := get.New()