epage / clapng

A full featured, fast Command Line Argument Parser for Rust
docs.rs/clap
Apache License 2.0
0 stars 0 forks source link

Multicall executables should support matching argv[0] with a prefix stripped off #217

Open epage opened 2 years ago

epage commented 2 years ago

Issue by fishface60 Tuesday Oct 12, 2021 at 20:49 GMT Originally opened as https://github.com/clap-rs/clap/issues/2864


Please complete the following tasks

Clap Version

3.0.0-beta.4

Describe your use case

The implementation of multicall needs to match the executable name against the program's name or any applets. If it doesn't match any then it treats it as the applet not being found.

It should not be required for the executable name to match applet names exactly.

It's not uncommon for a program to be installed with a custom prefix added to the binary name e.g. GNU coreutils being installed prefixed with g e.g. gcp on non-GNU unix systems, or https://github.com/uutils/coreutils/ installing as uu-cp.

Describe the solution you'd like

uutils handles it by stripping off any string that ends with a non-alphanumeric character https://github.com/uutils/coreutils/blob/40a895f79dca20b06fbec365038655a4031e90d0/src/bin/coreutils.rs#L64 however this wouldn't handle gcp.

Alternatives, if applicable

It could be built with a predetermined prefix rather than programmatically inferring a prefix to strip, in the style of coreutils' ./configure file's --program-prefix, --program-suffix or --program-transform-name options.

Additional Context

No response