Provide a way to generate hardlinks for binaries under different names #8213
Labels
A-cargo-targets
Area: selection and definition of targets (lib, bins, examples, tests, benches)
C-feature-request
Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`
S-needs-team-input
Status: Needs input from team on whether/how to proceed.
It's not uncommon for commandline tools to take different actions when invoked under different names. An extreme example of this is
busybox
which implements a slew of standard POSIX shell utilities. Its FAQ says:Given that Rust does not encourage dynamic linking if a project wants to create multiple binaries with a shared core of functionality there aren't many other good options. Even with dynamic linking on the table, being able to easily produce and distribute statically-linked binaries is a big selling point of writing commandline tools in Rust.
Describe the solution you'd like
Some way to specify an aliased name for
bin
targets that cargo would honor as part of the build would be helpful. As a strawman, perhaps:Would ask cargo to install this binary as both
mybin
andanothername
. Ideally this would happen via hardlinks, but on platforms where they're not available copying the binary to the aliased names seems acceptable.Notes
This came up while discussing feature additions to
ripgrep
. Therg
command is not amenable to subcommands given how it handles commandline arguments so adding new functionality that isn't part of searching means adding awkward options.The text was updated successfully, but these errors were encountered: