Version 0.2.4
* Notifications now display errors and the output of the failed command. * CI configs for GitHub and Woodpecker * Added `version` subcommand * Console logging can be disabled by setting `console-disabled` in the `logging` object * If Host was not defined for an incomplete `hosts` object, any commands would fail as they could not look up the values in the SSH config files.
This commit is contained in:
@ -12,11 +12,10 @@ import (
|
||||
|
||||
var (
|
||||
backupCmd = &cobra.Command{
|
||||
Use: "backup [--lists==list1,list2]",
|
||||
Use: "backup [--lists=list1,list2]",
|
||||
Short: "Runs commands defined in config file.",
|
||||
Long: `Backup executes commands defined in config file.
|
||||
Use the --lists flag to execute the specified commands.`,
|
||||
Run: Backup,
|
||||
Long: "Backup executes commands defined in config file.\nUse the --lists flag to execute the specified commands. If not specified, all lists will be executed.",
|
||||
Run: Backup,
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -8,9 +8,9 @@ import (
|
||||
|
||||
var (
|
||||
cronCmd = &cobra.Command{
|
||||
Use: "cron command ...",
|
||||
Short: "Runs commands defined in config file.",
|
||||
Long: `Cron executes commands at the time defined in config file.`,
|
||||
Use: "cron [flags]",
|
||||
Short: "Runs command lists defined in config file.",
|
||||
Long: `Cron starts a scheduler that executes command lists at the time defined in config file.`,
|
||||
Run: cron,
|
||||
}
|
||||
)
|
||||
|
@ -29,6 +29,5 @@ func execute(cmd *cobra.Command, args []string) {
|
||||
opts := backy.NewOpts(cfgFile, backy.AddCommands(args))
|
||||
opts.InitConfig()
|
||||
// opts.InitMongo()
|
||||
backy.ReadConfig(opts).ExecuteCmds()
|
||||
|
||||
backy.ReadConfig(opts).ExecuteCmds(opts)
|
||||
}
|
||||
|
@ -36,5 +36,5 @@ func init() {
|
||||
rootCmd.PersistentFlags().StringVarP(&cfgFile, "config", "f", "", "config file to read from")
|
||||
rootCmd.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "Sets verbose level")
|
||||
|
||||
rootCmd.AddCommand(backupCmd, execCmd, cronCmd)
|
||||
rootCmd.AddCommand(backupCmd, execCmd, cronCmd, versionCmd)
|
||||
}
|
||||
|
25
cmd/version.go
Normal file
25
cmd/version.go
Normal file
@ -0,0 +1,25 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
const versionStr = "0.2.4"
|
||||
|
||||
var (
|
||||
versionCmd = &cobra.Command{
|
||||
Use: "version",
|
||||
Short: "Prints the version and exits.",
|
||||
Run: version,
|
||||
}
|
||||
)
|
||||
|
||||
func version(cmd *cobra.Command, args []string) {
|
||||
|
||||
fmt.Printf("v%s\n", versionStr)
|
||||
|
||||
os.Exit(0)
|
||||
}
|
Reference in New Issue
Block a user