Documentation ¶
Index ¶
- Constants
- Variables
- func CmdAwsInstances(util awsUtil.AwsInterface) func(c *cli.Context) error
- func CmdAwsInstancesHelper(c *cli.Context, util awsUtil.AwsInterface) error
- func CmdAwsLoadBalancer(util awsUtil.AwsInterface) func(*cli.Context) error
- func CmdAwsLoadBalancerHelper(c *cli.Context, util awsUtil.AwsInterface) error
- func CmdBuild(c *cli.Context) error
- func CmdCreateConfig(c *cli.Context) error
- func CmdGlobalIPAdd(c *cli.Context) error
- func CmdGlobalIPList(c *cli.Context) error
- func CmdGlobalIPRemove(c *cli.Context) error
- func CmdGroupAdd(c *cli.Context) error
- func CmdGroupList(c *cli.Context) error
- func CmdGroupSet(c *cli.Context) error
- func CmdGroupShow(c *cli.Context) error
- func CmdHostAdd(c *cli.Context) error
- func CmdHostList(c *cli.Context) error
- func CmdHostRemove(c *cli.Context) error
- func CmdHostSet(c *cli.Context) error
- func CmdHostShow(c *cli.Context) error
- func CompleteAwsInstances(util awsUtil.AwsInterface) func(c *cli.Context)
- func CompleteAwsInstancesHelper(c *cli.Context, util awsUtil.AwsInterface)
- func CompleteAwsLoadBalancer(util awsUtil.AwsInterface) func(c *cli.Context)
- func CompleteAwsLoadBalancerHelper(c *cli.Context, util awsUtil.AwsInterface)
- func CompleteBuild(c *cli.Context)
- func CompleteCreateConfig(c *cli.Context)
- func CompleteGlobalIPAdd(c *cli.Context)
- func CompleteGlobalIPRemove(c *cli.Context)
- func CompleteGroupAdd(c *cli.Context)
- func CompleteGroupSet(c *cli.Context)
- func CompleteGroupShow(c *cli.Context)
- func CompleteHostAdd(c *cli.Context)
- func CompleteHostRemove(c *cli.Context)
- func CompleteHostSet(c *cli.Context)
- func CompleteHostShow(c *cli.Context)
- func RootCompletion(c *cli.Context)
Constants ¶
const Name string = "hostBuilder"
Name is the name of this program
const Version string = "0.3.2"
Version is the current version
Variables ¶
var Commands = []cli.Command{ { Name: "createConfig", Aliases: []string{"c"}, Usage: "Create a config file from an existing hosts file", Action: CmdCreateConfig, BashComplete: CompleteCreateConfig, Flags: []cli.Flag{ cli.StringFlag{ Name: "hostsFile, hosts", Usage: "The path to your hosts file", Value: "/etc/hosts", }, }, }, { Name: "build", Aliases: []string{"b"}, Usage: "Builds your host file", Action: CmdBuild, BashComplete: CompleteBuild, Flags: []cli.Flag{ cli.StringFlag{ Name: "output, o", Usage: "The path to write your hosts file", EnvVar: "HOST_BUILDER_OUTPUT_FILE", }, cli.BoolFlag{ Name: "oneLinePerIP", Usage: "Put all hosts for an IP on the same line", }, }, }, { Name: "globalIP", Aliases: []string{"gl"}, Usage: "Add things to the configuration", Category: "Config", BashComplete: RootCompletion, Subcommands: []cli.Command{ { Name: "add", Aliases: []string{"a"}, Usage: "Add a global IP to the configuration", Action: CmdGlobalIPAdd, BashComplete: CompleteGlobalIPAdd, Flags: []cli.Flag{forceFlag}, }, { Name: "remove", Aliases: []string{"r"}, Usage: "Remove a global IP from the configuration", Action: CmdGlobalIPRemove, BashComplete: CompleteGlobalIPRemove, }, { Name: "list", Aliases: []string{"l"}, Usage: "List global IPs in the configuration", Action: CmdGlobalIPList, }, }, }, { Name: "host", Aliases: []string{"ho"}, Usage: "Modify hosts", Category: "Config", BashComplete: RootCompletion, Subcommands: []cli.Command{ { Name: "add", Aliases: []string{"a"}, Usage: "Add an IP to a hostname", Action: CmdHostAdd, BashComplete: CompleteHostAdd, Flags: []cli.Flag{forceFlag}, }, { Name: "remove", Aliases: []string{"r"}, Usage: "Remove an IP from a hostname", Action: CmdHostRemove, BashComplete: CompleteHostRemove, }, { Name: "list", Aliases: []string{"l"}, Usage: "List the available hostnames", Action: CmdHostList, }, { Name: "show", Aliases: []string{"sh"}, Usage: "Describe the IPs on a hostname", Action: CmdHostShow, BashComplete: CompleteHostShow, }, { Name: "set", Aliases: []string{"se"}, Usage: "Set a hostname to a specific ip", Action: CmdHostSet, BashComplete: CompleteHostSet, }, }, }, { Name: "group", Aliases: []string{"gr"}, Usage: "Modify groups", Category: "Config", BashComplete: RootCompletion, Subcommands: []cli.Command{ { Name: "add", Aliases: []string{"a"}, Usage: "Add a hostname to a group", Action: CmdGroupAdd, BashComplete: CompleteGroupAdd, }, { Name: "list", Aliases: []string{"l"}, Usage: "List available groups", Action: CmdGroupList, }, { Name: "show", Aliases: []string{"sh"}, Usage: "List the hostnames in a group", Action: CmdGroupShow, BashComplete: CompleteGroupShow, }, { Name: "set", Aliases: []string{"se"}, Usage: "Set the hostnames in a group to a global ip", Action: CmdGroupSet, BashComplete: CompleteGroupSet, }, }, }, { Name: "aws", Aliases: []string{"a"}, Usage: "Add information from AWS to the configuration", Category: "Config", BashComplete: RootCompletion, Subcommands: []cli.Command{ { Name: "loadBalancers", Aliases: []string{"l", "lb"}, Usage: "Add load balancer information to the configuration", Action: CmdAwsLoadBalancer(new(awsUtil.AwsUtil)), BashComplete: CompleteAwsLoadBalancer(new(awsUtil.AwsUtil)), Flags: []cli.Flag{profileFlag}, }, { Name: "instances", Aliases: []string{"i"}, Usage: "Add instance information to the configuration", Action: CmdAwsInstances(new(awsUtil.AwsUtil)), BashComplete: CompleteAwsInstances(new(awsUtil.AwsUtil)), Flags: []cli.Flag{ profileFlag, cli.StringFlag{ Name: "template, t", Usage: "The template to use for naming instance ips", EnvVar: "HOST_BUILDER_INSTANCE_TEMPLATE", Value: "{{.InstanceId}}", }, }, }, }, }, }
Commands defines the commands that can be called on hostBuilder
var GlobalFlags = []cli.Flag{ cli.StringFlag{ Name: "config, c", Usage: "The path to your config file", EnvVar: "HOST_BUILDER_CONFIG_FILE", }, }
GlobalFlags defines flags that apply to all commands
Functions ¶
func CmdAwsInstances ¶
func CmdAwsInstances(util awsUtil.AwsInterface) func(c *cli.Context) error
CmdAwsInstances adds aws instance information to the configuration
func CmdAwsInstancesHelper ¶
func CmdAwsInstancesHelper(c *cli.Context, util awsUtil.AwsInterface) error
CmdAwsInstancesHelper uses the given awsUtil to add aws instance information to the configuration
func CmdAwsLoadBalancer ¶
func CmdAwsLoadBalancer(util awsUtil.AwsInterface) func(*cli.Context) error
CmdAwsLoadBalancer adds aws load balancer information to the configuration
func CmdAwsLoadBalancerHelper ¶
func CmdAwsLoadBalancerHelper(c *cli.Context, util awsUtil.AwsInterface) error
CmdAwsLoadBalancerHelper uses the given awsUtil to add aws load balancer information to the configuration
func CmdCreateConfig ¶
CmdCreateConfig creates a config file from an existing hosts file
func CmdGlobalIPAdd ¶
CmdGlobalIPAdd adds an ip to the global ip list
func CmdGlobalIPList ¶
CmdGlobalIPList adds an ip to the global ip list
func CmdGlobalIPRemove ¶
CmdGlobalIPRemove adds an ip to the global ip list
func CmdGroupList ¶
CmdGroupList lists the groups in the configuration
func CmdGroupSet ¶
CmdGroupSet sets the hostnames in a group to a global ip
func CmdGroupShow ¶
CmdGroupShow lists the hostnames in a group
func CmdHostList ¶
CmdHostList lists the hostNames in the configuration
func CmdHostRemove ¶
CmdHostRemove removes a host from the configuration
func CmdHostSet ¶
CmdHostSet sets the current IP on a hostname
func CmdHostShow ¶
CmdHostShow describes the current state of a host
func CompleteAwsInstances ¶
func CompleteAwsInstances(util awsUtil.AwsInterface) func(c *cli.Context)
CompleteAwsInstances handles bash autocompletion for the 'aws instances' command
func CompleteAwsInstancesHelper ¶
func CompleteAwsInstancesHelper(c *cli.Context, util awsUtil.AwsInterface)
CompleteAwsInstancesHelper handles bash autocompletion for the 'aws instances' command
func CompleteAwsLoadBalancer ¶
func CompleteAwsLoadBalancer(util awsUtil.AwsInterface) func(c *cli.Context)
CompleteAwsLoadBalancer handles bash autocompletion for the 'aws loadBalancers' command
func CompleteAwsLoadBalancerHelper ¶
func CompleteAwsLoadBalancerHelper(c *cli.Context, util awsUtil.AwsInterface)
CompleteAwsLoadBalancerHelper handles bash autocompletion for the 'aws instances' command
func CompleteBuild ¶
CompleteBuild handles bash autocompletion for the 'build' command
func CompleteCreateConfig ¶
CompleteCreateConfig handles bash autocompletion for the 'createConfig' command
func CompleteGlobalIPAdd ¶
CompleteGlobalIPAdd handles bash autocompletion for the 'globalIP add' command
func CompleteGlobalIPRemove ¶
CompleteGlobalIPRemove handles bash autocompletion for the 'globalIP remove' command
func CompleteGroupAdd ¶
CompleteGroupAdd handles bash autocompletion for the 'group add' command
func CompleteGroupSet ¶
CompleteGroupSet handles bash autocompletion for the 'group set' command
func CompleteGroupShow ¶
CompleteGroupShow handles bash autocompletion for the 'group show' command
func CompleteHostAdd ¶
CompleteHostAdd handles bash autocompletion for the 'host add' command
func CompleteHostRemove ¶
CompleteHostRemove handles bash autocompletion for the 'host remove' command
func CompleteHostSet ¶
CompleteHostSet handles bash autocompletion for the 'host set' command
func CompleteHostShow ¶
CompleteHostShow handles bash autocompletion for the 'host show' command
func RootCompletion ¶ added in v0.3.0
RootCompletion prints the list of root commands as the root completion method This is similar to the default method, but it excludes aliases
Types ¶
This section is empty.