Fix prerun
This commit is contained in:
parent
45eb4c9f3e
commit
9ad1ed17c2
2 changed files with 4 additions and 1 deletions
3
Makefile
3
Makefile
|
@ -44,3 +44,6 @@ backupplain:
|
||||||
|
|
||||||
test:
|
test:
|
||||||
go test -v ./...
|
go test -v ./...
|
||||||
|
|
||||||
|
run:
|
||||||
|
go run -v ./cmd/stillbox/ serve
|
||||||
|
|
|
@ -24,7 +24,7 @@ func main() {
|
||||||
}
|
}
|
||||||
rootCmd.PersistentFlags().BoolP("version", "V", false, "show version")
|
rootCmd.PersistentFlags().BoolP("version", "V", false, "show version")
|
||||||
cfg := config.New(rootCmd)
|
cfg := config.New(rootCmd)
|
||||||
rootCmd.Run = func(cmd *cobra.Command, args []string) {
|
rootCmd.PreRun = func(cmd *cobra.Command, args []string) {
|
||||||
v, _ := rootCmd.PersistentFlags().GetBool("version")
|
v, _ := rootCmd.PersistentFlags().GetBool("version")
|
||||||
if v {
|
if v {
|
||||||
fmt.Print(version.String())
|
fmt.Print(version.String())
|
||||||
|
|
Loading…
Reference in a new issue