Add --debug flag to kpod to turn up logging level to debug

Also set default level of logging to errors,  we should not see
info messages in the kpod command line.

While adding this patch, I found missing options in kpod command line
and bash completions, so I added them in.

Also fixed some sorting issues in the way commands are displayer in help or in
bash completions.

Finally fixed the error message to be output on failure using logrus.Errorf, so
we don't get the stack any longer.

Also updated README.md with missing kpod commands.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
Daniel J Walsh 2017-08-10 13:58:29 -04:00
parent fb2ee59225
commit 464d6852de
6 changed files with 73 additions and 16 deletions

View file

@ -15,6 +15,7 @@ func main() {
if reexec.Init() {
return
}
logrus.SetLevel(logrus.ErrorLevel)
app := cli.NewApp()
app.Name = "kpod"
@ -27,20 +28,28 @@ func main() {
imagesCommand,
infoCommand,
inspectCommand,
loadCommand,
mountCommand,
pullCommand,
pushCommand,
rmiCommand,
saveCommand,
tagCommand,
umountCommand,
versionCommand,
saveCommand,
loadCommand,
}
app.Flags = []cli.Flag{
cli.StringFlag{
Name: "config, c",
Usage: "path of a config file detailing container server configuration options",
},
cli.BoolFlag{
Name: "debug",
Usage: "print debugging information",
},
cli.StringFlag{
Name: "root",
Usage: "path to the root directory in which data, including images, is stored",
Usage: "path to the root directory in which data, including images, is stored",
},
cli.StringFlag{
Name: "runroot",
@ -54,12 +63,9 @@ func main() {
Name: "storage-opt",
Usage: "used to pass an option to the storage driver",
},
cli.StringFlag{
Name: "config, c",
Usage: "path of a config file detailing container server configuration options",
},
}
if err := app.Run(os.Args); err != nil {
logrus.Fatal(err)
logrus.Errorf(err.Error())
os.Exit(1)
}
}