github.com/scaleway/scaleway-cli@v1.11.1/pkg/commands/command.go (about) 1 // Copyright (C) 2015 Scaleway. All rights reserved. 2 // Use of this source code is governed by a MIT-style 3 // license that can be found in the LICENSE.md file. 4 5 // Package commands contains the workflows behind each commands of the CLI (run, attach, start, exec, commit, ...) 6 package commands 7 8 import ( 9 "io" 10 "os" 11 12 "github.com/scaleway/scaleway-cli/pkg/api" 13 ) 14 15 // Streams is used to redirects the streams 16 type Streams struct { 17 Stdin io.Reader 18 Stdout io.Writer 19 Stderr io.Writer 20 } 21 22 // CommandContext is passed to all commands and contains streams, environment, api and arguments 23 type CommandContext struct { 24 Streams 25 26 Env []string 27 RawArgs []string 28 API *api.ScalewayAPI 29 } 30 31 // Getenv returns the equivalent of os.Getenv for the CommandContext.Env 32 func (c *CommandContext) Getenv(key string) string { 33 // FIXME: parse c.Env instead 34 return os.Getenv(key) 35 }