Skip to content

use full command as aliases - #31

Merged
thaJeztah merged 1 commit into
docker:mainfrom
thaJeztah:full_alias
Jun 28, 2022
Merged

use full command as aliases#31
thaJeztah merged 1 commit into
docker:mainfrom
thaJeztah:full_alias

Conversation

@thaJeztah

Copy link
Copy Markdown
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 <github@gone.nl>
@thaJeztah
thaJeztah requested a review from crazy-maxJune 28, 2022 10:09
@codecov-commenter

Copy link
Copy Markdown

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 FilesCoverage Δ
clidocstool.go61.29% <100.00%> (+10.26%)⬆️
clidocstool_md.go76.21% <100.00%> (-0.15%)⬇️
clidocstool_yaml.go58.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
Copy Markdown
MemberAuthor

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

@crazy-maxcrazy-max left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@thaJeztah

Copy link
Copy Markdown
MemberAuthor

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

@thaJeztah
thaJeztah merged commit 5add522 into docker:mainJun 28, 2022
@thaJeztah
thaJeztah deleted the full_alias branch June 28, 2022 23:59
Sign up for freeto 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

@thaJeztah@codecov-commenter@crazy-max