1
Fork 0
mirror of https://github.com/RGBCube/nu_scripts synced 2025-08-02 07:07:46 +00:00

Case insensitive and reformatted make completions (#515)

* case-insensitive makefile completion

* format makefile completions
This commit is contained in:
ShinyZero0 2023-05-27 00:00:23 +03:00 committed by GitHub
parent c698547b3b
commit 35db6d1e28
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,20 +1,29 @@
def "nu-complete make" [] {
open ./Makefile|lines|find ':'|where ($it|str starts-with '.') == false|split column ' '|get column1|find ':'|str replace ':' ''
}
ls
| find --ignore-case makefile
| open $in.0.name
| lines
| find ':'
| where ($it | str starts-with '.') == false
| split column ' '
| get column1
| find ':'
| str replace ':' ''
}
def "nu-complete make jobs" [] {
seq 1 (sys|get cpu|length)
}
def "nu-complete make jobs" [] {
seq 1 (sys | get cpu | length)
}
def "nu-complete make files" [] {
ls **/*|where type == file|get name
}
def "nu-complete make files" [] {
ls **/* | where type == file | get name
}
def "nu-complete make dirs" [] {
ls **/*|where type == dir|get name
}
def "nu-complete make dirs" [] {
ls **/* | where type == dir | get name
}
export extern "make" [
export extern "make" [
command?: string@"nu-complete make"
--always-make(-B) # Unconditionally make all targets.
--directory(-C): string@"nu-complete make dirs" # Change to DIRECTORY before doing anything.
@ -53,4 +62,4 @@ def "nu-complete make" [] {
--new-file: string@"nu-complete make files"
--assume-new: string@"nu-complete make files"
--warn-undefined-variables # Warn when an undefined variable is referenced.
]
]