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

ps: un-deprecate --filter, and enhance docs #9266

Merged
merged 1 commit into from
Mar 10, 2022

Conversation

thaJeztah
Copy link
Member

Compose currently only supports a single filter options on --filter,
for which reason the --status flag was added, which is more convenient
to use.

However, the --filter flag is common among various docker commands, and
it's possible that additional filters get added at some point (which may
be less "commonly" used, and not warrant a dedicated flag).

This PR removes the "deprecated" mention from the flag, to keep consistency
with other commands, but adds documentation to explain how they relate to
eachother.

Also added a short example for the --format flag.

What I did

Related issue

(not mandatory) A picture of a cute animal, if possible in relation with what you did


## Examples

### <a name="format"></a> Format the output (--format)
Copy link
Member Author

Choose a reason for hiding this comment

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

This is an enhancement we made to the generator; when documenting specific flags, you can add a <a name="name-of-flag"></a> anchor, which will then automatically be linked from the list of flags (both on GitHub and on docs.docker.com. It's a bit of a "hack" to workaround difference between GitHub flavoured markdown (for viewing on GitHub), and markdown options supported by Jekyll (as used for docs.docker.com), but it works "ok" 😂

Copy link
Contributor

@glours glours left a comment

Choose a reason for hiding this comment

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

Sounds good to me, thanks @thaJeztah

@@ -8,21 +8,109 @@ List containers
| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `-a`, `--all` | | | Show all stopped containers (including those created by the run command) |
| `--format` | `string` | `pretty` | Format the output. Values: [pretty \| json] |
| [`--format`](#format) | `string` | `pretty` | Format the output. Values: [pretty \| json] |
Copy link
Member Author

Choose a reason for hiding this comment

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

oh! I think I missed something; the flag is not showing up here 🤔 Let me double check (was it "hidden" or so?)

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, that was it; changed that 😅

@@ -81,12 +81,11 @@ func psCommand(p *projectOptions, backend api.Service) *cobra.Command {
}
flags := psCmd.Flags()
flags.StringVar(&opts.Format, "format", "pretty", "Format the output. Values: [pretty | json]")
flags.StringVar(&opts.Filter, "filter", "", "Filter services by a property. Deprecated, use --status instead")
flags.StringVar(&opts.Filter, "filter", "", "Filter services by a property (currently supported filters: status).")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
flags.StringVar(&opts.Filter, "filter", "", "Filter services by a property (currently supported filters: status).")
flags.StringVar(&opts.Filter, "filter", "", "Filter services by a property (supported filters: status).")

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, good one. I was going back-and-forth on whether I should use "currently" or not.

You're right; it looks better without; let me fix and push

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!

Compose currently only supports a single filter options on --filter,
for which reason the --status flag was added, which is more convenient
to use.

However, the `--filter` flag is common among various docker commands, and
it's possible that additional filters get added at some point (which may
be less "commonly" used, and not warrant a dedicated flag).

This PR removes the "deprecated" mention from the flag, to keep consistency
with other commands, but adds documentation to explain how they relate to
eachother.

Also added a short example for the `--format` flag.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@ndeloof ndeloof enabled auto-merge (rebase) March 10, 2022 19:35
@ndeloof ndeloof merged commit 2d32d74 into docker:v2 Mar 10, 2022
@thaJeztah thaJeztah deleted the undeprecate_filter branch March 10, 2022 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants