Skip to content

Commit

Permalink
Improve CLI help
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelsauter committed Apr 2, 2018
1 parent 4de62ac commit e7dd6e4
Showing 1 changed file with 35 additions and 35 deletions.
70 changes: 35 additions & 35 deletions crane/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,26 @@ var defaultFiles = []string{"docker-compose.yml", "docker-compose.override.yml",
var (
app = kingpin.New("crane", "Lift containers with ease - https://www.craneup.tech").Interspersed(false).DefaultEnvars()
verboseFlag = app.Flag("verbose", "Enable verbose output.").Short('v').Bool()
dryRunFlag = app.Flag("dry-run", "Dry run (implicit verbose, no side effects).").Bool()
dryRunFlag = app.Flag("dry-run", "Dry run (implicitly verbose; no side effects).").Bool()
configFlag = app.Flag(
"config",
"Location of config file.",
"Location of config file(s).",
).Short('c').Default(defaultFiles...).PlaceHolder("~/crane.yml").Strings()
prefixFlag = app.Flag(
"prefix",
"Container/Network/Volume prefix.",
).Short('p').String()
excludeFlag = app.Flag(
"exclude",
"Exclude group or container. Can be repeated.",
"Exclude group or container (repeatable).",
).Short('x').PlaceHolder("container|group").Strings()
onlyFlag = app.Flag(
"only",
"Include only group or container.",
"Limit scope to group or container.",
).Short('o').PlaceHolder("container|group").String()
extendFlag = app.Flag(
"extend",
"Extend command from target to dependencies",
"Extend command from target to dependencies.",
).Short('e').Bool()
tagFlag = app.Flag(
"tag",
Expand All @@ -44,45 +44,45 @@ var (

upCommand = app.Command(
"up",
"Build or pull images if they don't exist, then run or start the containers.",
"Build or pull images if they don't exist, then run or start the containers. Alias of `lift`.",
)
upNoCacheFlag = upCommand.Flag(
"no-cache",
"Build the image without any cache.",
"Build the image(s) without any cache.",
).Short('n').Bool()
upParallelFlag = upCommand.Flag(
"parallel",
"Define how many containers are provisioned in parallel.",
).Short('l').Default("1").Int()
upDetachFlag = upCommand.Flag(
"detach",
"Detach from container",
"Detach from targeted container.",
).Short('d').Bool()
upTargetArg = upCommand.Arg("target", "Target of command").String()
upCmdArg = upCommand.Arg("cmd", "Command for container").Strings()

liftCommand = app.Command(
"lift",
"Build or pull images if they don't exist, then run or start the containers.",
"Build or pull images if they don't exist, then run or start the containers. Alias of `up`.",
)
liftNoCacheFlag = liftCommand.Flag(
"no-cache",
"Build the image without any cache.",
"Build the image(s) without any cache.",
).Short('n').Bool()
liftParallelFlag = liftCommand.Flag(
"parallel",
"Define how many containers are provisioned in parallel.",
).Short('l').Default("1").Int()
liftDetachFlag = liftCommand.Flag(
"detach",
"Detach from container",
"Detach from targeted container.",
).Short('d').Bool()
liftTargetArg = liftCommand.Arg("target", "Target of command").String()
liftCmdArg = liftCommand.Arg("cmd", "Command for container").Strings()

versionCommand = app.Command(
"version",
"Displays the current version and checks for update.",
"Display the current version and check for updates.",
)
versionNoCheckFlag = versionCommand.Flag(
"no-check",
Expand All @@ -91,63 +91,63 @@ var (

statsCommand = app.Command(
"stats",
"Displays statistics about containers.",
"Display statistics about containers.",
)
statsNoStreamFlag = statsCommand.Flag(
"no-stream",
"Disable stats streaming (Docker >= 1.7).",
"Disable stats streaming.",
).Short('n').Bool()
statsTargetArg = statsCommand.Arg("target", "Target of command").String()

statusCommand = app.Command(
"status",
"Displays status of containers.",
"Display status of containers (similar to `docker ps`).",
)
noTruncFlag = statusCommand.Flag(
"no-trunc",
"Don't truncate output.",
).Bool()
).Short('n').Bool()
statusTargetArg = statusCommand.Arg("target", "Target of command").String()

pushCommand = app.Command(
"push",
"Push the containers to the registry.",
"Push containers to the registry.",
)
pushTargetArg = pushCommand.Arg("target", "Target of command").String()

pauseCommand = app.Command(
"pause",
"Pause the containers.",
"Pause running containers.",
)
pauseTargetArg = pauseCommand.Arg("target", "Target of command").String()

unpauseCommand = app.Command(
"unpause",
"Unpause the containers.",
"Unpause paused containers.",
)
unpauseTargetArg = unpauseCommand.Arg("target", "Target of command").String()

startCommand = app.Command(
"start",
"Start the containers.",
"Start stopped containers. Non-existant containers will be created.",
)
startTargetArg = startCommand.Arg("target", "Target of command").String()

stopCommand = app.Command(
"stop",
"Stop the containers.",
"Stop running containers.",
)
stopTargetArg = stopCommand.Arg("target", "Target of command").String()

killCommand = app.Command(
"kill",
"Kill the containers.",
"Kill running containers.",
)
killTargetArg = killCommand.Arg("target", "Target of command").String()

execCommand = app.Command(
"exec",
"Execute command in the container(s).",
"Execute command in the targeted container(s). Stopped containers will be started, non-existant containers will be created first.",
)
execPrivilegedFlag = execCommand.Flag(
"privileged",
Expand All @@ -162,11 +162,11 @@ var (

rmCommand = app.Command(
"rm",
"Remove the containers.",
"Remove stopped containers.",
)
rmForceFlag = rmCommand.Flag(
"force",
"Kill containers if they are running first.",
"Remove running containers, too.",
).Short('f').Bool()
rmVolumesFlag = rmCommand.Flag(
"volumes",
Expand All @@ -176,18 +176,18 @@ var (

runCommand = app.Command(
"run",
"Run the containers.",
"Run containers. Already existing containers will be removed first.",
)
runDetachFlag = runCommand.Flag(
"detach",
"Detach from container",
"Detach from container.",
).Short('d').Bool()
runTargetArg = runCommand.Arg("target", "Target of command").String()
runCmdArg = runCommand.Arg("cmd", "Command for container").Strings()

createCommand = app.Command(
"create",
"Create the containers.",
"Create containers. Already existing containers will be removed first.",
)
createTargetArg = createCommand.Arg("target", "Target of command").String()
createCmdArg = createCommand.Arg("cmd", "Command for container").Strings()
Expand All @@ -198,7 +198,7 @@ var (
)
provisionNoCacheFlag = provisionCommand.Flag(
"no-cache",
"Build the image without any cache.",
"Build the image(s) without any cache.",
).Short('n').Bool()
provisionParallelFlag = provisionCommand.Flag(
"parallel",
Expand All @@ -214,33 +214,33 @@ var (

logsCommand = app.Command(
"logs",
"Display container logs.",
"Show container logs.",
)
followFlag = logsCommand.Flag(
"follow",
"Follow log output.",
).Short('f').Bool()
tailFlag = logsCommand.Flag(
"tail",
"Output the specified number of lines at the end of logs.",
"Define number of lines to display at the end of the logs.",
).String()
timestampsFlag = logsCommand.Flag(
"timestamps",
"Show timestamps.",
).Short('t').Bool()
colorizeFlag = logsCommand.Flag(
"colorize",
"Output the lines with one color per container.",
"Use different color for each container.",
).Short('z').Bool()
sinceFlag = logsCommand.Flag(
"since",
"Show logs since timestamp (Docker >= 1.7).",
"Show logs since timestamp.",
).String()
logsTargetArg = logsCommand.Arg("target", "Target of command").String()

generateCommand = app.Command(
"generate",
"Generate files by passing the config to a given template.",
"Generate files by passing the config to given template.",
)
templateFlag = generateCommand.Flag(
"template",
Expand All @@ -258,7 +258,7 @@ var (
)
amResetCommand = amCommand.Command(
"reset",
"Resets accelerated mount",
"Reset accelerated mount",
)
amResetTargetArg = amResetCommand.Arg("target", "Target of command").String()
amLogsCommand = amCommand.Command(
Expand Down

0 comments on commit e7dd6e4

Please sign in to comment.