mirror of
https://github.com/Threnklyn/zeit.git
synced 2026-05-23 15:18:30 +02:00
Implemented program skeleton
This commit is contained in:
@@ -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() {
|
||||
}
|
||||
@@ -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)
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user