39 lines
860 B
Go
39 lines
860 B
Go
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)
|
|
}
|
|
}
|