Skip to content

Fix #2498 by dropping down hyphen to underscore in autocomplete bash script#2499

Open
btw04 wants to merge 3 commits intoremkop:mainfrom
btw04:main
Open

Fix #2498 by dropping down hyphen to underscore in autocomplete bash script#2499
btw04 wants to merge 3 commits intoremkop:mainfrom
btw04:main

Conversation

@btw04
Copy link
Copy Markdown

@btw04 btw04 commented Jan 12, 2026

As discussed in #2498, this should probably fix the duplicate-name issue. I still think that the alias function is a duplicate which could be completely removed, but this should be an important patch nonetheless.

Please let me know if this patch no longer conforms with the intention of bashify.

@btw04
Copy link
Copy Markdown
Author

btw04 commented Jan 12, 2026

A note on this: I tested it for the aliases = {"foobar", "foo-bar"} case where it worked as intended.

@remkop
Copy link
Copy Markdown
Owner

remkop commented Jan 13, 2026

@btw04 Thank you for the PR!
It covers the specific error case, but if an option has an alias with underscores, we will have the same problem again.
It's probably better to eliminate duplicate function names after bashify is called.

(Away from pc now, maybe we can store the names in a set, that may be one way to implement this...)

@btw04
Copy link
Copy Markdown
Author

btw04 commented Jan 13, 2026

You are right, I did not quite consider the bigger picture here. Maybe I can also think up a cleaner solution in the next couple of days.

@btw04
Copy link
Copy Markdown
Author

btw04 commented Jan 14, 2026

I think this should be a fairly local patch for the issue. There possibly are other issues related to this, if alias duplication is not checked in another place (i.e. if two different commands have the same subcommand), but I would argue such cases to be a different issue needing a different approach.

Specifically, I think that the initial problem where two aliases are only differentiated by a hyphen might be the most common. This and similar cases should be fully resolved now.

@remkop
Copy link
Copy Markdown
Owner

remkop commented Jan 18, 2026

Thank you for the PR!

I noticed that your proposal uses fairly recent API and language features, and I want to point out that picocli is still compiled on Java 5 (https://github.com/remkop/picocli?tab=contributing-ov-file).
It will be slightly more verbose and less elegant with the old API and syntax but can I ask you to take a look?
Many thanks! 🙏

@btw04
Copy link
Copy Markdown
Author

btw04 commented Jan 19, 2026

Thank you for your time. I must have missed that part of the contributing information, sorry! The new commit refactors it for Java 5.

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