Skip to content

Conversation

thaJeztah
Copy link
Member

The default output for Cobra aliases only shows the subcommand as alias, which
is not very intuitive. This patch changes the output to use the full command
as it would be called by the user.

Before this patch:

aliases: build, b

After this patch:

aliases: docker buildx build, docker buildx b

Note that there's still some improvements to be made; due to how aliases must be
set-up in Cobra, aliases at different "levels" are still not shown. So for example,
docker build --help will not show docker buildx build as alias, and vice-versa.
This will require additional changes, and can possibly be resolved using custom
metadata/annotations.

The default output for Cobra aliases only shows the subcommand as alias, which
is not very intuitive. This patch changes the output to use the full command
as it would be called by the user.

Before this patch:

    aliases: build, b

After this patch:

    aliases: docker buildx build, docker buildx b

Note that there's still some improvements to be made; due to how aliases must be
set-up in Cobra, aliases at different "levels" are still not shown. So for example,
`docker build --help` will not show `docker buildx build` as alias, and vice-versa.
This will require additional changes, and can possibly be resolved using custom
metadata/annotations.

Signed-off-by: Sebastiaan van Stijn <[email protected]>
@thaJeztah thaJeztah requested a review from crazy-max June 28, 2022 10:09
@codecov-commenter
Copy link

Codecov Report

Merging #31 (23f22d3) into main (b4dab44) will increase coverage by 0.77%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main      #31      +/-   ##
==========================================
+ Coverage   64.84%   65.62%   +0.77%     
==========================================
  Files           4        4              
  Lines         532      544      +12     
==========================================
+ Hits          345      357      +12     
  Misses        129      129              
  Partials       58       58              
Impacted Files Coverage Δ
clidocstool.go 61.29% <100.00%> (+10.26%) ⬆️
clidocstool_md.go 76.21% <100.00%> (-0.15%) ⬇️
clidocstool_yaml.go 58.30% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b4dab44...23f22d3. Read the comment docs.

@thaJeztah
Copy link
Member Author

@crazy-max PTAL; let me know if this LGTY as a stepping stone (follow-up is in #32)

Copy link
Member

@crazy-max crazy-max left a comment

Choose a reason for hiding this comment

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

LGTM

@thaJeztah
Copy link
Member Author

Let me bring this one in and rebase the other one 👍

@thaJeztah thaJeztah merged commit 5add522 into docker:main Jun 28, 2022
@thaJeztah thaJeztah deleted the full_alias branch June 28, 2022 23:59
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.

3 participants