add(cli): cli interface for push, pull and version
This commit is contained in:
38
cmd/root.go
Normal file
38
cmd/root.go
Normal file
@@ -0,0 +1,38 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
var (
|
||||
dry_run bool
|
||||
rootCmd = &cobra.Command{
|
||||
Use: "gitw",
|
||||
Short: "Git issue and milestone integration for taskwarrior",
|
||||
Long: `Gitwarrior is a CLI tool to extend the taskwarrior tasks to synch issues and milestones.
|
||||
Gitwarrior requires requires the following uda's to be defined: last_gitw_update(date), git_number(number), git_type(string), git_comment_ids(string).`,
|
||||
}
|
||||
)
|
||||
|
||||
func Execute() error {
|
||||
return rootCmd.Execute()
|
||||
}
|
||||
|
||||
func init() {
|
||||
cobra.OnInitialize(initConfig)
|
||||
}
|
||||
|
||||
func initConfig() {
|
||||
viper.SetConfigName("config")
|
||||
viper.SetConfigType("yaml")
|
||||
viper.AddConfigPath("$HOME/.config/gitw")
|
||||
viper.AutomaticEnv()
|
||||
if err := viper.ReadInConfig(); err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Failed to read configuration file: %s\n", err)
|
||||
os.Exit(-1)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user