Documentation ¶
Index ¶
Constants ¶
View Source
const Name = "converge"
Name describes the name for packaging
View Source
const Version = "0.2.0"
Version describes the version for packaging
Variables ¶
View Source
var RootCmd = &cobra.Command{ Use: Name, Short: Name + " applies changes to systems over a graph", Long: Name + ` is a tool that reads modules files (see the samples directory in the source) and applies their actions to a system. The workflow generally looks like this: 1. write your module files 2. see what changes will happen with "converge plan yourfile.hcl" 3. apply the changes with "converge apply yourfile.hcl" You can also visualize the execution graph with "converge graph yourfile.hcl" - see "converge graph --help" for more details.`, PersistentPreRunE: func(cmd *cobra.Command, args []string) error { level, err := cmd.Flags().GetString("log-level") if err != nil { return err } parsedLevel, err := log.ParseLevel(level) if err != nil { return err } log.SetLevel(parsedLevel) nocolor, err := cmd.Flags().GetBool("nocolor") if err != nil { return err } log.SetFormatter(&logging.Formatter{ DisableColors: nocolor, }) sub := cmd subFlags := args for { log.WithField("command", sub.Name()).Debug("registering flags") if err := viper.BindPFlags(sub.Flags()); err != nil { return errors.Wrapf(err, "failed to bind flags for %s", sub.Name()) } if err := viper.BindPFlags(sub.PersistentFlags()); err != nil { return errors.Wrapf(err, "failed to bind persistent flags for %s", sub.Name()) } potentialSub, potentialSubFlags, err := sub.Find(subFlags) if err != nil { return errors.Wrapf(err, "failed to get child for %s", sub.Name()) } if sub == potentialSub { break } sub = potentialSub subFlags = potentialSubFlags } return nil }, }
RootCmd represents the base command when called without any subcommands
Functions ¶
func Execute ¶
func Execute()
Execute adds all child commands to the root command sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.
func GracefulExit ¶
func GracefulExit(cancel context.CancelFunc)
GracefulExit traps interrupt signals for a graceful exit
func GracefulExitBlocking ¶
func GracefulExitBlocking(cancel context.CancelFunc)
GracefulExitBlocking handles graceful exits, and blocks until exit
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.