mirror of
https://github.com/RGBCube/nu_scripts
synced 2025-08-01 06:37:46 +00:00
🐛 Fix rustup
use completions and modify README (#696)
Hey, it's me, I finally fixed this `use` vs `source` script.nu 😄
Also, I added a few lines of the `custom-completions/README.md` to
explain what happened in my case
This commit is contained in:
parent
9700391563
commit
af92dca520
2 changed files with 16 additions and 2 deletions
|
@ -4,6 +4,20 @@ This current directory provides custom completions. They can be used by importin
|
|||
|
||||
```nushell
|
||||
use path/to/<command>/<command>-completions.nu *
|
||||
# or
|
||||
source path/to/<command>/<command>-completions.nu
|
||||
# without the `*` at the end
|
||||
```
|
||||
|
||||
With `path/to/<command>` being either the relative path of the file to your current working directory or its absolute path.
|
||||
|
||||
Bear in mind that if you import the `use <path> *`, it is important that you don't name a function with the same name of the file
|
||||
|
||||
```nu
|
||||
# file: rustup.nu
|
||||
|
||||
export extern rustup [
|
||||
...args
|
||||
]
|
||||
```
|
||||
`use ./rustup.nu *` won't work here
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# ------------------ nu-complete commands ------------------
|
||||
|
||||
|
||||
def "nu-complete rustup" [] {
|
||||
^rustup --help
|
||||
| str replace --regex --multiline '(rustup[\s\S]*(?=SUBCOMMANDS:))' ''
|
||||
|
@ -131,7 +131,7 @@ def "nu-complete rustup completions shell" [] {
|
|||
# ------------------ export extern commands ------------------
|
||||
|
||||
export extern "rustup" [
|
||||
command?: string@"nu-complete rustup"
|
||||
command?: string@"nu-complete rustup"
|
||||
--verbose(-v) # Enable verbose output
|
||||
--quiet(-q) # Disable progress output
|
||||
--help(-h) # Print help information
|
Loading…
Add table
Add a link
Reference in a new issue