Implemented program skeleton

This commit is contained in:
マリウス
2020-10-11 01:58:14 +01:00
parent cf1cc31a12
commit 3f5454426d
5 changed files with 203 additions and 8 deletions
+29
View File
@@ -0,0 +1,29 @@
package z
import (
"fmt"
"github.com/spf13/cobra"
"os"
)
var developer string
var rootCmd = &cobra.Command{
Use: "zeit",
Short: "Command line Zeiterfassung",
Long: `A command line time tracker.`,
}
func Execute() {
if err := rootCmd.Execute(); err != nil {
fmt.Println(err)
os.Exit(1)
}
}
func init() {
cobra.OnInitialize(initConfig)
}
func initConfig() {
}
+22
View File
@@ -0,0 +1,22 @@
package z
import (
"fmt"
"github.com/spf13/cobra"
)
var VERSION string
func init() {
rootCmd.AddCommand(versionCmd)
}
var versionCmd = &cobra.Command{
Use: "version",
Short: "Display what Zeit it is",
Long: `The version of Zeit.`,
Run: func(cmd *cobra.Command, args []string) {
fmt.Println("Zeit", VERSION)
},
}