Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix help commands to show short and long description. #2564

Merged
merged 1 commit into from
Mar 7, 2019

Conversation

rhatdan
Copy link
Member

@rhatdan rhatdan commented Mar 6, 2019

Cleanup lots of help information to look good when displayed.

Signed-off-by: Daniel J Walsh dwalsh@redhat.com

Examples added by @TomSweeneyRedHat

[root@localhost ~]# podman build --help
Builds an OCI or Docker image using instructions from one
or more Dockerfiles and a specified build context directory.

Usage:
  podman build [flags] CONTEXT

Examples:
  podman build .
  podman build --cert-dir ~/auth --creds=username:password -t imageName -f Dockerfile.simple .
  podman build --layers --force-rm --tag imageName .

Flags:
      --add-host host:ip                           add a custom host-to-IP mapping (host:ip) (default [])
      --annotation strings                         Set metadata for an image (default [])
      --authfile string                            path of the authentication file. Default is ${XDG_RUNTIME_DIR}/containers/auth.json
      --build-arg argument=value                   argument=value to supply to the builder
      --cache-from string                          Images to utilise as potential cache sources. The build process does not currently support caching so this is a NOOP.
      --cap-add strings                            add the specified capability when running (default [])
      --cap-drop strings                           drop the specified capability when running (default [])
      --cert-dir string                            use certificates at the specified path to access the registry
      --cgroup-parent string                       optional parent cgroup for the container
      --cni-plugin-path path                       path of CNI network plugins (default "/usr/libexec/cni:/opt/cni/bin")
      --compress                                   This is legacy option, which has no effect on the image
      --cpu-period uint                            limit the CPU CFS (Completely Fair Scheduler) period
      --cpu-quota int                              limit the CPU CFS (Completely Fair Scheduler) quota
  -c, --cpu-shares uint                            CPU shares (relative weight)
      --cpuset-cpus string                         CPUs in which to allow execution (0-3, 0,1)

Podman build help after:

# podman build --help
Build an image using instructions from Dockerfiles

Description:

Builds an OCI or Docker image using instructions from one or more Dockerfiles and a specified build context directory.

Usage:
  podman build [flags] CONTEXT

Examples:
  podman build .
  podman build --cert-dir ~/auth --creds=username:password -t imageName -f Dockerfile.simple .
  podman build --layers --force-rm --tag imageName .

Flags:
      --add-host host:ip                           add a custom host-to-IP mapping (host:ip) (default [])
      --annotation strings                         Set metadata for an image (default [])
      --authfile string                            path of the authentication file. Default is ${XDG_RUNTIME_DIR}/containers/auth.json
      --build-arg argument=value                   argument=value to supply to the builder
      --cache-from string                          Images to utilise as potential cache sources. The build process does not currently support caching so this is a NOOP.
      --cap-add strings                            add the specified capability when running (default [])
      --cap-drop strings                           drop the specified capability when running (default [])
      --cert-dir string                            use certificates at the specified path to access the registry
      --cgroup-parent string                       optional parent cgroup for the container
      --cni-plugin-path path                       path of CNI network plugins (default "/usr/libexec/cni:/opt/cni/bin")
      --compress                                   This is legacy option, which has no effect on the image
      --cpu-period uint                            limit the CPU CFS (Completely Fair Scheduler) period
      --cpu-quota int                              limit the CPU CFS (Completely Fair Scheduler) quota
  -c, --cpu-shares uint                            CPU shares (relative weight)

Podman diff help before:

# podman diff --help
Displays changes on a container or image's filesystem.  The
	container or image will be compared to its parent layer

Usage:
  podman diff [flags] CONTAINER | IMAGE

Examples:
  podman diff imageID
  podman diff ctrID
  podman diff --format json redis:alpine

Flags:
      --format string   Change the output format
  -h, --help            help for diff

Podman diff help after:

# podman diff --help
Inspect changes on container's file systems

Description:

Displays changes on a container or image's filesystem.  The container or image will be compared to its parent layer.

Usage:
  podman diff [flags] CONTAINER | IMAGE

Examples:
  podman diff imageID
  podman diff ctrID
  podman diff --format json redis:alpine

Flags:
      --format string   Change the output format
  -h, --help            help for diff

@openshift-ci-robot openshift-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L labels Mar 6, 2019
@@ -39,6 +39,8 @@ var (

func init() {
runCommand.Command = _runCommand
runCommand.SetHelpTemplate(HelpTemplate())
runCommand.SetHelpTemplate(HelpTemplate())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dup?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.


Description:

{{.Long}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For consistency with the rest of the output, would you consider (1) removing the empty line between Description: and the text, and (2) indenting {{.Long}} two spaces?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update: well, that's harder than I thought: multi-line descriptions (import, info, inspect, ...) would need to be manually indented. I see no clean way to deal with this but hope someone can.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I think similar fun here as with the examples. They'd have to be manually indented. I think "as is" is probably the best case.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will remove the line for now.

@TomSweeneyRedHat
Copy link
Member

Top biting this one, gonna rekick.

@TomSweeneyRedHat
Copy link
Member

bot, retest this please.

@TomSweeneyRedHat
Copy link
Member

One probable small change, otherwise LGTM.

Copy link
Member

@edsantiago edsantiago left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM; only minor comments.

I see a lot of 'The container name or ID can be used.'; are those really necessary?

grep -L suggests that healthcheck_run.go might be another candidate for a Description.

podman exec

Run a command in a running container
execDescription = `Execute the specified command inside of a running container.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for 'of'; just 'inside a container' is best. Also, extra space character.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

cmd/podman/cp.go Outdated
@@ -27,8 +27,9 @@ import (
var (
cpCommand cliconfig.CpValues

cpDescription = "Copy files/folders between a container and the local filesystem"
_cpCommand = &cobra.Command{
cpDescription = `The podman cp utility copies the contents of SRC_PATH to the DEST_PATH. You can copy from the container's file system to the local machine or the reverse, from the local filesystem to the container. If - is specified for either the SRC_PATH or DEST_PATH, you can also stream a tar archive from STDIN or to STDOUT. The CONTAINER can be a running or stopped container. The SRC_PATH or DEST_PATH can be a file or directory.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The convention I see for the most part is to document as 'Action blah blah'; It feels jarring to see this one as 'The podman cp utility ...'. How about just 'Copy the contents'?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed to `Commant copies ...

_inspectCommand = &cobra.Command{
inspectDescription = `This displays the low-level information on containers and images identified by name or ID.

By default, this will render all results in a JSON array. If the container and image have the same name, this command returns the container JSON.`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this isn't part of your commit, but why not change that to something more readable such as 'If given a name that matches both a container and an image, this command inspects the container.'

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@@ -15,8 +15,10 @@ import (

var (
logsCommand cliconfig.LogsValues
logsDescription = "The podman logs command batch-retrieves whatever logs are present for a container at the time of execution. This does not guarantee execution" +
"order when combined with podman run (i.e. your run may not have generated any logs at the time you execute podman logs"
logsDescription = `The podman logs command batch-retrieves whatever logs are present for a container at the time of execution.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same principle as cp above: 'Retrieves whatever logs ...'

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

cmd/podman/rm.go Outdated
Podman rm will remove one or more containers from the host.
The container name or ID can be used. This does not remove images.
Running containers will not be removed without the -f option.
rmDescription = fmt.Sprintf(`Podman rm will remove one or more containers from the host. The container name or ID can be used.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another unnecessary Podman; just 'Remove one or more...' might be better.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed


run varlink interface
Tools speaking valink protocol can remotely manage pods, containers and images.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo (valink)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@rhatdan rhatdan force-pushed the cleanup branch 2 times, most recently from 0a5c7bf to 034b879 Compare March 7, 2019 13:56
`
containerExistsDescription = `
podman container exists
containerExistsDescription = `If an container exists in local storage, podman container exists exits with 0, otherwise exit code will be 1.`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a container, not an; likewise for pod below.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modified the comment.

_inspectCommand = &cobra.Command{
inspectDescription = `This displays the low-level information on containers and images identified by name or ID.

If given a namee that matches both a container and an image, this command inspects the container. By default, this will render all results in a JSON array.`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: namee

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@@ -12,8 +12,10 @@ import (

var (
podUnpauseCommand cliconfig.PodUnpauseValues
podUnpauseDescription = `Unpauses one or more pods. The pod name or ID can be used.`
_podUnpauseCommand = &cobra.Command{
podUnpauseDescription = `The podman unpause command will unpause "paused" all containers assigned to the pod.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was that meant to be will unpause all "paused" containers? I'm not sure how to parse it otherwise.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

the latest container.
%s
`, getDescriptorString())
topDescription = fmt.Sprintf(`Similare to system top command.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: Similare

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@@ -16,12 +16,9 @@ import (

var (
volumePruneCommand cliconfig.VolumePruneValues
volumePruneDescription = `
podman volume prune
volumePruneDescription = `Command prompts for confirmation if not using the --force flag.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No longer says what this command does ("Remove all unused volumes"). Was that intentional?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

Cleanup lots of help information to look good when displayed.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: edsantiago, rhatdan

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@edsantiago
Copy link
Member

/lgtm

Thank you for your patience with my nits

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Mar 7, 2019
@openshift-merge-robot openshift-merge-robot merged commit 94e89fc into containers:master Mar 7, 2019
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 27, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants