cmd toolbox: handle missing error checks
This commit is contained in:
parent
b849e2c07e
commit
ced6108963
|
@ -43,5 +43,5 @@ func expanddirRun(cmd *cobra.Command, args []string) {
|
||||||
log.Fatalf("failed to expand dir %q: %v", expDir, err)
|
log.Fatalf("failed to expand dir %q: %v", expDir, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
io.WriteString(os.Stdout, expDir)
|
_, _ = io.WriteString(os.Stdout, expDir)
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,9 @@
|
||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"log"
|
||||||
|
"os"
|
||||||
|
|
||||||
"agola.io/agola/cmd"
|
"agola.io/agola/cmd"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
@ -25,9 +28,15 @@ var CmdToolbox = &cobra.Command{
|
||||||
Short: "toolbox",
|
Short: "toolbox",
|
||||||
Version: cmd.Version,
|
Version: cmd.Version,
|
||||||
// just defined to make --version work
|
// just defined to make --version work
|
||||||
Run: func(c *cobra.Command, args []string) { c.Help() },
|
Run: func(c *cobra.Command, args []string) {
|
||||||
|
if err := c.Help(); err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
func Execute() {
|
func Execute() {
|
||||||
CmdToolbox.Execute()
|
if err := CmdToolbox.Execute(); err != nil {
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue