Skip to content

Commit

Permalink
add basic version command
Browse files Browse the repository at this point in the history
  • Loading branch information
tempor1s committed Mar 9, 2020
1 parent db1ea0f commit d778ada
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cmd/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ var backupCommand = &cobra.Command{
Use: "backup [github.com/username]",
Short: "Backup all of the repos at a given github URL",
Long: "This command will backup all of the repos from a user into your CURRENT directory.",
Run: backup,
// Run the backup command
Run: backup,
}

// TODO: Put this into another file as to not muddy up the cmd package that should only be used for managing commands
func backup(cmd *cobra.Command, args []string) {
fmt.Println("Hello, from the backup command!")
}
20 changes: 20 additions & 0 deletions cmd/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package cmd

import (
"fmt"

"github.com/spf13/cobra"
)

func init() {
rootCmd.AddCommand(versionCommand)
}

var versionCommand = &cobra.Command{
Use: "version",
Short: "Print the version of GoBackup",
Long: "All software has a version, and this is GoBackup's.",
Run: func(cmd *cobra.Command, args []string) {
fmt.Println("GoBackup's Version: Unreleased")
},
}

0 comments on commit d778ada

Please sign in to comment.