cmd

package
v0.0.0-...-2337eca Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2017 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RootCmd = &cobra.Command{
	Use:   "backup",
	Short: "Backup application for securely storing incremental backups",
	Long: `Backup application designed to work with Amazon Glacier in
mind, but can also handle local filesystem based backups.`,
	PersistentPreRun: func(cmd *cobra.Command, args []string) {
		if _, err := os.Stat(cfgPath); os.IsNotExist(err) {
			os.MkdirAll(cfgPath, 0755)
		}

		logFile, _ := cmd.InheritedFlags().GetString("log-file")
		logFile = os.ExpandEnv(logFile)
		f, err := os.OpenFile(logFile, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
		if err != nil {
			fmt.Printf("Error opening log file, defaulting to stderr: %s\n", err)
			f = nil
		}

		debug, _ := cmd.InheritedFlags().GetBool("debug")
		log.SetupLogging(f, os.Stderr, debug, debug)
	},
}

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