command

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2016 License: MIT Imports: 11 Imported by: 0

README

github.com/conjurinc/summon/command

Provides the flags and action for the Summon command-line interface.

Documentation

Index

Constants

View Source
const ENV_FILE_MAGIC = "@SUMMONENVFILE"

Variables

View Source
var Action = func(c *cli.Context) {
	if !c.Args().Present() {
		fmt.Println("Enter a subprocess to run!")
		os.Exit(1)
	}

	provider, err := prov.Resolve(c.String("provider"))
	if err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	}

	out, err := runAction(
		c.Args(),
		provider,
		c.String("f"),
		c.String("yaml"),
		convertSubsToMap(c.StringSlice("D")),
		c.StringSlice("ignore"),
	)

	if err != nil {
		fmt.Println(out + ": " + err.Error())
		os.Exit(1)
	}
}
View Source
var Flags = []cli.Flag{
	cli.StringFlag{
		Name:  "p, provider",
		Usage: "Path to provider for fetching secrets",
	},
	cli.StringFlag{
		Name:  "f",
		Value: "secrets.yml",
		Usage: "Path to secrets.yml",
	},
	cli.StringSliceFlag{
		Name:  "D",
		Value: &cli.StringSlice{},
		Usage: "var=value causes substitution of value to $var",
	},
	cli.StringFlag{
		Name:  "yaml",
		Usage: "secrets.yml as a literal string",
	},
	cli.StringSliceFlag{
		Name:  "ignore, i",
		Value: &cli.StringSlice{},
		Usage: "Ignore the specified key if is isn't accessible or doesn’t exist",
	},
}

Functions

func DefaultTempPath

func DefaultTempPath() string

Default temporary file path; returns /dev/shm if it is a directory else returns the system default

Types

type TempFactory

type TempFactory struct {
	// contains filtered or unexported fields
}

func NewTempFactory

func NewTempFactory(path string) TempFactory

Create a new temporary file factory. defer Cleanup() if you want the files removed.

func (*TempFactory) Cleanup

func (tf *TempFactory) Cleanup()

Remove the temporary files created with this factory.

func (*TempFactory) Push

func (tf *TempFactory) Push(value string) string

Create a temp file with given value. Returns the path.

Jump to

Keyboard shortcuts

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