cmd

package
v0.0.0-...-01c1a50 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2016 License: Apache-2.0 Imports: 12 Imported by: 0

README

Command Parsing

This package has all the sauce for command parsing. Some guidelines follow.

  • init() methods for subcommands can error out if something is wrong, and the command will immediately exit.
  • The Run() function of a command should not log.Fatal(), os.Exit(), or panic(), as it will bypass cleanup.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RootCmd = &cobra.Command{
	Use:   "roper",
	Short: "A Yum repo server and manager",
	Long: `
Roper is a server that can manage your Yum repositories, and serve them
up on a built in web server.  Most notably, it will watch configured
repositories and automatically run the 'createrepo' program
against them (if desired) when changes are detected.`,
	PersistentPreRun: func(cmd *cobra.Command, args []string) {
		// create controller
		var err error
		rc, err = controller.Init(dbPath, crPath)
		if err != nil {
			log.Fatalf("Unable to initialize application: %s", err)
		}
	},
	PersistentPostRun: func(cmd *cobra.Command, args []string) {

		if rc != nil {
			rc.Close()
		}
	},
}

This 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.

Types

This section is empty.

Jump to

Keyboard shortcuts

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