Skip to content

feat(tools): add aliases subcommand to generate sourcable alias output - #5142

Open
theZMC wants to merge 1 commit into
zarf-dev:mainfrom
theZMC:5073-create-an-aliases-subcommand
Open

feat(tools): add aliases subcommand to generate sourcable alias output#5142
theZMC wants to merge 1 commit into
zarf-dev:mainfrom
theZMC:5073-create-an-aliases-subcommand

Conversation

@theZMC

@theZMC theZMC commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Description

This PR adds an aliases subcommand to the tools subcommand that outputs a curated set of sourcable aliases on stdout.

Runtime Examples

zarf itself

❯ go run main.go tools aliases
2026-08-10 15:41:45 INF using config file location=/Users/zach.callahan/Code/github.com/thezmc/zarf-dev-zarf/zarf-config.toml
alias kubectl='/Users/zach.callahan/Library/Caches/go-build/f4/f470d7aa51b12692e79fd37dc33a993fa0562f6cfaab4ba97f0ae519a8cb07f2-d/main tools kubectl'
alias helm='/Users/zach.callahan/Library/Caches/go-build/f4/f470d7aa51b12692e79fd37dc33a993fa0562f6cfaab4ba97f0ae519a8cb07f2-d/main tools helm'
alias yq='/Users/zach.callahan/Library/Caches/go-build/f4/f470d7aa51b12692e79fd37dc33a993fa0562f6cfaab4ba97f0ae519a8cb07f2-d/main tools yq'
alias k9s='/Users/zach.callahan/Library/Caches/go-build/f4/f470d7aa51b12692e79fd37dc33a993fa0562f6cfaab4ba97f0ae519a8cb07f2-d/main tools monitor'
alias syft='/Users/zach.callahan/Library/Caches/go-build/f4/f470d7aa51b12692e79fd37dc33a993fa0562f6cfaab4ba97f0ae519a8cb07f2-d/main tools sbom'

❯ source <(go run main.go tools aliases)
2026-08-10 15:41:49 INF using config file location=/Users/zach.callahan/Code/github.com/thezmc/zarf-dev-zarf/zarf-config.toml

❯ for cmd in k9s kubectl helm syft yq; do which $cmd; done
k9s: aliased to /Users/zach.callahan/Library/Caches/go-build/f4/f470d7aa51b12692e79fd37dc33a993fa0562f6cfaab4ba97f0ae519a8cb07f2-d/main tools monitor
kubectl: aliased to /Users/zach.callahan/Library/Caches/go-build/f4/f470d7aa51b12692e79fd37dc33a993fa0562f6cfaab4ba97f0ae519a8cb07f2-d/main tools kubectl
helm: aliased to /Users/zach.callahan/Library/Caches/go-build/f4/f470d7aa51b12692e79fd37dc33a993fa0562f6cfaab4ba97f0ae519a8cb07f2-d/main tools helm
syft: aliased to /Users/zach.callahan/Library/Caches/go-build/f4/f470d7aa51b12692e79fd37dc33a993fa0562f6cfaab4ba97f0ae519a8cb07f2-d/main tools sbom
yq: aliased to /Users/zach.callahan/Library/Caches/go-build/f4/f470d7aa51b12692e79fd37dc33a993fa0562f6cfaab4ba97f0ae519a8cb07f2-d/main tools yq

❯ kubectl --help | tail -n5
Usage:
  zarf tools kubectl [flags] [options]

Use "kubectl <command> --help" for more information about a given command.
Use "zarf tools kubectl options" for a list of global command-line options (applies to all commands).

Vendored as part of uds

❯ grep 'replace' go.mod
replace github.com/zarf-dev/zarf => ../../thezmc/zarf-dev-zarf

❯ uds run build 2>/dev/null

❯ build/uds zarf tools aliases
alias kubectl='/Users/zach.callahan/Code/github.com/defenseunicorns/uds-cli/build/uds zarf tools kubectl'
alias helm='/Users/zach.callahan/Code/github.com/defenseunicorns/uds-cli/build/uds zarf tools helm'
alias yq='/Users/zach.callahan/Code/github.com/defenseunicorns/uds-cli/build/uds zarf tools yq'
alias k9s='/Users/zach.callahan/Code/github.com/defenseunicorns/uds-cli/build/uds zarf tools monitor'
alias syft='/Users/zach.callahan/Code/github.com/defenseunicorns/uds-cli/build/uds zarf tools sbom'

❯ source <(build/uds zarf tools aliases)

❯ which kubectl
kubectl: aliased to /Users/zach.callahan/Code/github.com/defenseunicorns/uds-cli/build/uds zarf tools kubectl

❯ kubectl --help | tail -n5
Usage:
  zarf tools kubectl [flags] [options]

Use "kubectl <command> --help" for more information about a given command.
Use "zarf tools kubectl options" for a list of global command-line options (applies to all commands).

Related Issue

Fixes #5073

Checklist before merging

@netlify

netlify Bot commented Jul 31, 2026

Copy link
Copy Markdown

Deploy Preview for zarf-docs canceled.

Name Link
🔨 Latest commit 6805c14
🔍 Latest deploy log https://app.netlify.com/projects/zarf-docs/deploys/6a7de0ff47875d0007c38dca

@theZMC
theZMC force-pushed the 5073-create-an-aliases-subcommand branch 14 times, most recently from ec0ea09 to 1e49529 Compare August 10, 2026 22:43
@theZMC
theZMC marked this pull request as ready for review August 10, 2026 22:46
@theZMC
theZMC requested review from a team as code owners August 10, 2026 22:46
@codecov

codecov Bot commented Aug 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 70.58824% with 15 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/cmd/tools_aliases.go 70.00% 12 Missing and 3 partials ⚠️
Files with missing lines Coverage Δ
src/cmd/tools.go 91.66% <100.00%> (+0.23%) ⬆️
src/cmd/tools_aliases.go 70.00% <70.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@theZMC
theZMC marked this pull request as draft August 10, 2026 23:50
@theZMC
theZMC force-pushed the 5073-create-an-aliases-subcommand branch 4 times, most recently from b89224f to 4163b12 Compare August 11, 2026 19:24
@theZMC
theZMC marked this pull request as ready for review August 11, 2026 19:27
@theZMC
theZMC force-pushed the 5073-create-an-aliases-subcommand branch 2 times, most recently from 3f4c471 to e615eff Compare August 13, 2026 14:52
@theZMC
theZMC force-pushed the 5073-create-an-aliases-subcommand branch from e615eff to 6805c14 Compare August 13, 2026 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Create an aliases subcommand to output a curated sourcable set of aliases for bundled tools

1 participant