add(cli): cli interface for push, pull and version

This commit is contained in:
2023-10-26 00:32:25 +02:00
parent 854dafde01
commit 32a389d464
14 changed files with 750 additions and 64 deletions

38
cmd/root.go Normal file
View 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)
}
}