Skip to content

Commit 598ff1a

Browse files
authored
feat: add new cargo aliases and fix autocompletion (#1161)
Added official Cargo aliases locally: - b -> cargo build - c -> cargo check - d -> cargo doc - r -> cargo run - rm -> cargo remove - t -> cargo test These aliases already exist in Cargo; this just adds convenient shortcuts. Fixed the Nushell cargo autocompletion function: changed from 'column1' to 'column0' so that subcommands are correctly suggested instead of returning nothing.
1 parent 5f248ac commit 598ff1a

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

custom-completions/cargo/cargo-completions.nu

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def "nu-complete cargo features" [] {
3030
# `cargo --list` is slow, `open` is faster.
3131
# TODO: Add caching.
3232
def "nu-complete cargo subcommands" [] {
33-
^cargo --list | lines | skip 1 | str join "\n" | from ssv --noheaders | get column1
33+
^cargo --list | lines | skip 1 | str join "\n" | from ssv --noheaders | get column0
3434
}
3535
def "nu-complete cargo vcs" [] {
3636
[
@@ -584,3 +584,11 @@ export extern "cargo add" [
584584
--target # Add as dependency to the given target platform
585585
...args
586586
]
587+
588+
# Cargo aliases
589+
export alias "cargo b" = cargo build
590+
export alias "cargo c" = cargo check
591+
export alias "cargo d" = cargo doc
592+
export alias "cargo r" = cargo run
593+
export alias "cargo rm" = cargo remove
594+
export alias "cargo t" = cargo test

0 commit comments

Comments
 (0)