Skip to content

Commit

Permalink
cmd: improve user interface for help message by add default text
Browse files Browse the repository at this point in the history
1. Fix missing default values in the --help after v0.6.1.
2. Sort out some usage information.

Signed-off-by: Qinqi Qu <quqinqi@linux.alibaba.com>
  • Loading branch information
adamqqqplay committed May 6, 2023
1 parent e80f79c commit e835623
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
4 changes: 2 additions & 2 deletions cmd/containerd-nydus-grpc/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ func main() {
return errors.Wrap(err, "failed to setup logger")
}

log.L.Infof("Start nydus-snapshotter. PID %d Version %s FsDriver %s DaemonMode %s",
os.Getpid(), version.Version, config.GetFsDriver(), snapshotterConfig.DaemonMode)
log.L.Infof("Start nydus-snapshotter. Version: %s, PID: %d, FsDriver: %s, DaemonMode: %s",
version.Version, os.Getpid(), config.GetFsDriver(), snapshotterConfig.DaemonMode)

return Start(ctx, &snapshotterConfig)
},
Expand Down
17 changes: 12 additions & 5 deletions internal/flags/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
package flags

import (
"github.com/containerd/nydus-snapshotter/internal/constant"
"github.com/urfave/cli/v2"
)

Expand Down Expand Up @@ -37,51 +38,57 @@ func buildFlags(args *Args) []cli.Flag {
Name: "root",
Usage: "directory to store snapshotter data and working states",
Destination: &args.RootDir,
DefaultText: constant.DefaultRootDir,
},
&cli.StringFlag{
Name: "address",
Usage: "remote snapshotter gRPC socket path",
Destination: &args.Address,
DefaultText: constant.DefaultAddress,
},
&cli.StringFlag{
Name: "config",
Usage: "path to nydus-snapshotter configuration file",
Usage: "path to nydus-snapshotter configuration (such as: config.toml)",
Destination: &args.SnapshotterConfigPath,
},
&cli.StringFlag{
Name: "nydus-image",
Usage: "path to `nydus-image` binary, default to search in $PATH",
Usage: "path to `nydus-image` binary, default to search in $PATH (such as: /usr/local/bin/nydus-image)",
Destination: &args.NydusImagePath,
},
&cli.StringFlag{
Name: "nydusd",
Usage: "path to `nydusd` binary, default to search in $PATH",
Usage: "path to `nydusd` binary, default to search in $PATH (such as: /usr/local/bin/nydusd)",
Destination: &args.NydusdPath,
},
&cli.StringFlag{
Name: "nydusd-config",
Aliases: []string{"config-path"},
Usage: "path to nydusd configuration file",
Usage: "path to nydusd configuration (such as: nydusd-config.json or nydusd-config-v2.toml)",
Destination: &args.NydusdConfigPath,
DefaultText: constant.DefaultNydusDaemonConfigPath,
},
&cli.StringFlag{
Name: "daemon-mode",
Usage: "nydusd daemon working mode, possible values: \"multiple\", \"shared\" or \"none\"",
Destination: &args.DaemonMode,
DefaultText: constant.DaemonModeMultiple,
},
&cli.StringFlag{
Name: "fs-driver",
Usage: "driver to mount RAFS filesystem, possible values: \"fusedev\", \"fscache\"",
Destination: &args.FsDriver,
DefaultText: constant.FsDriverFusedev,
},
&cli.StringFlag{
Name: "log-level",
Usage: "logging level, possible values: \"trace\", \"debug\", \"info\", \"warn\", \"error\"",
Destination: &args.LogLevel,
DefaultText: constant.DefaultLogLevel,
},
&cli.BoolFlag{
Name: "log-to-stdout",
Usage: "print log messages to STDOUT",
Usage: "print log messages to standard output",
Destination: &args.LogToStdout,
Count: &args.LogToStdoutCount,
},
Expand Down

0 comments on commit e835623

Please sign in to comment.