Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds support for a swx alias (symlink) to shopware-cli that automatically forwards all invocations to project console, effectively making swx behave as a shorthand for running Shopware console commands. The implementation maintains compatibility with shell completion systems while simplifying common console operations.
Changes:
- Added alias detection and argument mapping logic in cmd/root.go to intercept
swxinvocations and forward them toproject console - Added comprehensive unit tests covering various swx usage scenarios including completions
- Updated package manager configurations (AUR, Nix, nfpm, Homebrew) to create symbolic links from
shopware-clitoswx
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| cmd/root.go | Implements swx alias detection, argument mapping logic, and dynamic command naming based on invocation path |
| cmd/root_test.go | Adds unit tests for alias argument mapping and command name detection across Unix/Windows paths |
| .goreleaser.yaml | Configures package managers to create swx symlinks and handles installation/uninstallation hooks |
Comments suppressed due to low confidence (1)
.goreleaser.yaml:242
- When completions are generated for the swx command (e.g., via "swx completion bash"), the AUR, Nix, nfpm, and Homebrew packages only install shopware-cli completions, not swx completions. Users who want swx completions will need to generate them manually by running "swx completion bash/zsh/fish". Consider either documenting this in the package install hooks/readme, or automatically generating and installing both shopware-cli and swx completion files during the build process.
ln -sf "shopware-cli" "${pkgdir}/usr/bin/swx"
# license
install -Dm644 "./LICENSE" "${pkgdir}/usr/share/licenses/shopware-cli/LICENSE"
# completions
mkdir -p "${pkgdir}/usr/share/bash-completion/completions/"
mkdir -p "${pkgdir}/usr/share/zsh/site-functions/"
mkdir -p "${pkgdir}/usr/share/fish/vendor_completions.d/"
install -Dm644 "./completions/shopware-cli.bash" "${pkgdir}/usr/share/bash-completion/completions/shopware-cli"
install -Dm644 "./completions/shopware-cli.zsh" "${pkgdir}/usr/share/zsh/site-functions/_shopware-cli"
install -Dm644 "./completions/shopware-cli.fish" "${pkgdir}/usr/share/fish/vendor_completions.d/shopware-cli.fish"
nix:
- name: shopware-cli
repository:
owner: FriendsOfShopware
name: nur-packages
branch: main
token: "{{ .Env.NUR_GITHUB_TOKEN }}"
commit_author:
name: "Shopware Bot"
email: github@shopware.com
post_install: |
ln -sf "$out/bin/shopware-cli" "$out/bin/swx"
installShellCompletion --cmd shopware-cli \
--bash <($out/bin/shopware-cli completion bash) \
--zsh <($out/bin/shopware-cli completion zsh) \
--fish <($out/bin/shopware-cli completion fish)
homepage: "https://sw-cli.fos.gg"
description: "Command line tool for Shopware 6"
license: "mit"
nfpms:
-
package_name: shopware-cli
vendor: "shopware AG"
homepage: https://github.com/shopware/shopware-cli/
maintainer: Soner Sayakci <s.sayakci@shopware.com>
description: A cli which contains handy helpful commands for daily Shopware tasks
license: MIT
contents:
- src: /usr/bin/shopware-cli
dst: /usr/bin/swx
type: symlink
- src: ./completions/shopware-cli.bash
dst: /etc/bash_completion.d/shopware-cli
- src: ./completions/shopware-cli.fish
dst: /usr/share/fish/completions/shopware-cli.fish
- src: ./completions/shopware-cli.zsh
dst: /usr/local/share/zsh/site-functions/_shopware-cli
formats:
- apk
- deb
- rpm
homebrew_casks:
- name: shopware-cli
repository:
owner: shopware
name: homebrew-tap
token: "{{ .Env.HOMEBREW_TAP_GITHUB_TOKEN_SHOPWARE }}"
commit_author:
name: Frosh Automation
email: ci@fos.gg
homepage: https://shopware.com
description: Shopware CLI helps Shopware developers manage extensions
license: MIT
hooks:
post:
install: |
system_command "/bin/ln", args: ["-sf", "#{HOMEBREW_PREFIX}/bin/shopware-cli", "#{HOMEBREW_PREFIX}/bin/swx"]
uninstall: |
system_command "/bin/rm", args: ["-f", "#{HOMEBREW_PREFIX}/bin/swx"]
completions:
bash: completions/shopware-cli.bash
zsh: completions/shopware-cli.zsh
fish: completions/shopware-cli.fish
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
project consolewhile keeping completion commands intact and ensurerootCmd.Usematches the actual binary nameshopware-clitoswxand ensure completions/install hooks adjust accordingly