Closed dcstuff closed 1 week ago
hey, quick update:
I'm able to repro the panic, I've narrowed down the errors to sfdx-hardis
commands (some commands define the short flag -o
two times, carapace-spec
panics but it's a bug in the hardis plugin anyway).
I've spent some time yesterday trying to handle these collisions but the solution ended up being too convoluted and would be just a workaround (incomplete flag completion). I'll log an issue to sfdx-hardis with a detailed list of commands causing the problem, let's keep this issue open until that's fixed there 👍🏼
FWIW, we solved this issue about flag name collision in sf
a while ago with some oclif tooling and eslint rules:
https://github.com/salesforcecli/eslint-plugin-sf-plugin/
this rule specifically: https://github.com/salesforcecli/eslint-plugin-sf-plugin/blob/main/docs/rules/dash-o.md
I'll prefer plugins to adopt these rules if possible.
Thanks very much, @cristiand391. Nicolas is very responsive. I'm sure once he sees the bug, he'll get on it asap!
Hmmm any idea which sfdx-hardis commands has multiple -o defined ? :)
This is probably a bug than happened during sfdx to sf cli architecture migration :)
@nvuillam, I'll collect the full list and log an issue in the plugin repo later today.
Everyone's speediness on resolving this is very much appreciated!
On Mon, Oct 14, 2024, 12:44 p.m. Cristian Dominguez < @.***> wrote:
@nvuillam https://github.com/nvuillam, I'll collect the full list and log an issue in the plugin repo later today.
— Reply to this email directly, view it on GitHub https://github.com/cristiand391/oclif-carapace-spec-plugin/issues/1#issuecomment-2411765230, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKS32DVPEUHJOXN6JVJVB5TZ3PYIPAVCNFSM6AAAAABPSOSNQOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMJRG43DKMRTGA . You are receiving this because you authored the thread.Message ID: @.***>
I think I found the issues :)
I think i solved the issue with 5.2.0 :)
Please can you confirm @dcstuff @cristiand391 ? :)
@nvuillam
I think the -o
ones are fixed but now I see -d
duplicates:
➜ plugin-org git:(flagfeature) ✗ sf plugins inspect sfdx-hardis
› Warning: @salesforce/plugin-data is a linked ESM module and cannot be auto-transpiled. Existing compiled source will be used instead.
└─ sfdx-hardis
├─ version 5.2.0
...
panic: unable to redefine "d" shorthand in "promote" flagset: it's already used for "auto" flag
goroutine 1 [running]:
github.com/spf13/pflag.(*FlagSet).AddFlag(0xc0007c8800, 0xc0001c4fd0)
...
some command nodes:
- description: "Promote package(s) version(s): convert it from beta to released"
name: promote
flags:
--json: Format output as json.
--flags-dir: Import flag values from a directory.
-d, --auto: Auto-detect which versions of which packages need to be
promoted
-d, --debug: Activate debug mode (more logs)
--websocket: Websocket host:port for VsCode SFDX Hardis UI integration
--skipauth: Skip authentication check when a default username is required
-v, --target-dev-hub: Username or alias of the Dev Hub org. Not required if the
`target-dev-hub` configuration variable is already set.
- description: Simulate the deployment of a metadata in an org prompted to the
user
name: simulate
flags:
--json: Format output as json.
--flags-dir: Import flag values from a directory.
-d, --source-dir*: Source file or directory to simulate the deployment
-d, --debug: Activate debug mode (more logs)
--websocket: Websocket host:port for VsCode SFDX Hardis UI integration
--skipauth: Skip authentication check when a default username is required
-o, --target-org: Username or alias of the target org. Not required if the
`target-org` configuration variable is already set.
Damn there are others ^^
happy to do QA if you want to nuke all dups in one PR 😄
for context, this plugin (still WIP) generates a yaml description of sf
(any oclif CLI really) to get shell completion via carapace-spec:
https://github.com/carapace-sh/carapace-spec
here are the install instructions I shared with dcstuff on slack:
oh nvm, I see windows binaries for carapace-spec:
https://github.com/carapace-sh/carapace-spec/releases (click on Show all 20 assets)
can you try with my plugin?
1. install: `sf plugins install @cristiand391/oclif-carapace-spec-plugin`
2. generate spec: `sf carapace-gen`
3. source it in your bash profile like this: https://carapace-sh.github.io/carapace-spec/carapace-spec/usage.html#bash
then save & try on a new shell.
EDIT: step 0 would be to have the carapace-spec bin on your PATH :grin:, I should add a check for that. (edited)
@cristiand391 after my latest patch (v5.2.1) with -d
options I succeeded to run@cristiand391/oclif-carapace-spec-plugin locally and generated a full YML in temp folder :)
Please can you confirm it's ok on your side too ? :)
@nvuillam almost there!
carapece-spec
panics when sourcing the yaml file for your shell, my plugin generates the yaml
there's this one too in hardis scratch create
:
after removing that line carapace-spec
can parse the yaml successfully 😁
Noooo aanother patch :D
On it :)
@cristiand391 plz tell me it's ok with 5.2.2 🤣
@nvuillam yep, don't see a crash/panic on latest.
➜ plugin-org git:(flagfeature) ✗ sf plugins inspect sfdx-hardis
› Warning: @salesforce/plugin-data is a linked ESM module and cannot be auto-transpiled. Existing compiled source will be used instead.
└─ sfdx-hardis
├─ version 5.2.2
thanks for the quick fix! 🏆
@dcstuff I'll close this issue for now, if you find a different issue with carapace-spec on git bash for windows please open a new one.
Thanks, team!
Glad all is good now, and those bugs were quite harmless but... so ugly , thanks for reporting :)
$ sf -v @salesforce/cli/2.60.13 win32-x64 node-v20.17.0
$ sf plugins @cristiand391/oclif-carapace-spec-plugin 0.1.0 packaging 2.8.11 sfdmu 4.36.3 sfdx-essentials 2.12.0 sfdx-git-delta 5.46.0 sfdx-hardis 5.0.10 texei-sfdx-plugin 2.7.0