You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hopefully this isn't a duplicate, I haven't been able to find any similar issues so far.
Attempting to use an alias from a config file included with --config fails with an error message that doesn't really explain what went wrong:
$ cat ~/.config/cargo/custom.toml ───────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── │ File: /home/ian/.config/cargo/custom.toml───────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── 1 │ [alias] 2 │ p = "publish --dry-run"───────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
$ command cargo --config ~/.config/cargo/custom.toml p error: no such command: `p` Did you mean `p`? View all installed commands with `cargo --list` Find a package to install `p` with `cargo search cargo-p`
The suggested cargo --list is doesn't help, since it still shows the alias from the included config file:
$ command cargo +nightly --config ~/.config/cargo/custom.toml --list | grep -C2 'alias: pub' override owner Manage the owners of a crate on the registry p alias: publish --dry-run package Assemble the local package into a distributable tarball pkgid Print a fully qualified package specification
Steps
Create a config file with an alias (see above for example, e.g. p)
Attempt to use that alias by running cargo --config $PATH p
Observer error
Possible Solution(s)
What I would really like is for this to Just Work (i.e. treat the alias the same as if it was automatically picked up from ~/.config/cargo/config.toml; I wanted to use this as a workaround for #7723 not being implemented so I could add machine-specific aliases by including files from the command line.
At the very least, I think the error message Did you mean `p` message could be updated to include a message about this being unsupported or something like that.
Notes
A workaround is to create e.g. a custom cargo-p subcommand but I'd rather not have to do this for a lot of little convenience aliases and instead keep them all together in one config file.
Ah, I forgot to check if --config alias.foo had the same effect, maybe I would have found that issue if I thought to look for it. Good to know that CARGO_ALIAS_FOO also works, maybe I will be able to use that as a workaround in my case, thanks!
Problem
Hopefully this isn't a duplicate, I haven't been able to find any similar issues so far.
Attempting to use an alias from a config file included with
--config
fails with an error message that doesn't really explain what went wrong:The suggested
cargo --list
is doesn't help, since it still shows the alias from the included config file:Steps
p
)cargo --config $PATH p
Possible Solution(s)
What I would really like is for this to Just Work (i.e. treat the alias the same as if it was automatically picked up from
~/.config/cargo/config.toml
; I wanted to use this as a workaround for #7723 not being implemented so I could add machine-specific aliases by including files from the command line.At the very least, I think the error message
Did you mean `p`
message could be updated to include a message about this being unsupported or something like that.Notes
A workaround is to create e.g. a custom
cargo-p
subcommand but I'd rather not have to do this for a lot of little convenience aliases and instead keep them all together in one config file.Version
The text was updated successfully, but these errors were encountered: