github.com/mutagen-io/mutagen@v0.18.0-rc1/cmd/mutagen-agent/install.go (about) 1 package main 2 3 import ( 4 "fmt" 5 6 "github.com/spf13/cobra" 7 8 "github.com/mutagen-io/mutagen/cmd" 9 10 "github.com/mutagen-io/mutagen/pkg/agent" 11 ) 12 13 // installMain is the entry point for the install command. 14 func installMain(_ *cobra.Command, _ []string) error { 15 // Perform the installation. 16 if err := agent.Install(); err != nil { 17 return fmt.Errorf("installation error: %w", err) 18 } 19 20 // Success. 21 return nil 22 } 23 24 // installCommand is the install command. 25 var installCommand = &cobra.Command{ 26 Use: agent.CommandInstall, 27 Short: "Perform agent installation", 28 Args: cmd.DisallowArguments, 29 RunE: installMain, 30 SilenceUsage: true, 31 } 32 33 // installConfiguration stores configuration for the install command. 34 var installConfiguration struct { 35 // help indicates whether or not to show help information and exit. 36 help bool 37 } 38 39 func init() { 40 // Grab a handle for the command line flags. 41 flags := installCommand.Flags() 42 43 // Disable alphabetical sorting of flags in help output. 44 flags.SortFlags = false 45 46 // Manually add a help flag to override the default message. Cobra will 47 // still implement its logic automatically. 48 flags.BoolVarP(&installConfiguration.help, "help", "h", false, "Show help information") 49 }