mirror of
https://github.com/RGBCube/nu_scripts
synced 2025-08-01 14:47:47 +00:00
update scripts to support str replace
(#200)
This commit is contained in:
parent
577ad93638
commit
e6d8d2704e
10 changed files with 44 additions and 44 deletions
|
@ -1,5 +1,5 @@
|
|||
def "nu-complete git branches" [] {
|
||||
^git branch | lines | each { |line| $line | str find-replace '\* ' "" | str trim }
|
||||
^git branch | lines | each { |line| $line | str replace '\* ' "" | str trim }
|
||||
}
|
||||
|
||||
def "nu-complete git remotes" [] {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
def "nu-complete make" [] {
|
||||
open ./Makefile|lines|find ':'|where ($it|str starts-with '.') == false|split column ' '|get column1|find ':'|str find-replace ':' ''
|
||||
open ./Makefile|lines|find ':'|where ($it|str starts-with '.') == false|split column ' '|get column1|find ':'|str replace ':' ''
|
||||
}
|
||||
|
||||
def "nu-complete make jobs" [] {
|
||||
|
@ -30,27 +30,27 @@ def "nu-complete make" [] {
|
|||
--load-average(-l): int@"nu-complete make jobs" # Don't start multiple jobs unless load is below N.
|
||||
--check-symlink-times(-L) # Use the latest mtime between symlinks and target.
|
||||
--just-print(-n) # Don't actually run any recipe; just print them.
|
||||
--dry-run
|
||||
--recon
|
||||
--dry-run
|
||||
--recon
|
||||
--assume-old: string@"nu-complete make files" # Consider FILE to be very old and don't remake it.
|
||||
--old-file(-o): string@"nu-complete make files"
|
||||
--old-file(-o): string@"nu-complete make files"
|
||||
--output-sync(-O) # Synchronize output of parallel jobs by TYPE.
|
||||
--print-data-base(-p) # Print make's internal database.
|
||||
--question(-q) # Run no recipe; exit status says if up to date.
|
||||
--no-builtin-rules(-r) # Disable the built-in implicit rules.
|
||||
--no-builtin-variables(-R) # Disable the built-in variable settings.
|
||||
--silent(-s) # Don't echo recipes.
|
||||
--quiet
|
||||
--quiet
|
||||
--no-silent # Echo recipes (disable --silent mode).
|
||||
--stop(-S) # Turns off -k.
|
||||
--no-keep-going
|
||||
--no-keep-going
|
||||
--touch(-t) # Touch targets instead of remaking them.
|
||||
--trace # Print tracing information.
|
||||
--version(-v) # Print the version number of make and exit.
|
||||
--print-directory(-w) # Print the current directory.
|
||||
--no-print-directory # Turn off -w, even if it was turned on implicitly.
|
||||
--what-if(-W): string@"nu-complete files" # Consider FILE to be infinitely new.
|
||||
--new-file: string@"nu-complete files"
|
||||
--assume-new: string@"nu-complete files"
|
||||
--new-file: string@"nu-complete files"
|
||||
--assume-new: string@"nu-complete files"
|
||||
--warn-undefined-variables # Warn when an undefined variable is referenced.
|
||||
]
|
||||
|
|
|
@ -8,7 +8,7 @@ def "nu-complete npm" [] {
|
|||
|str trim
|
||||
|split column -c ' '
|
||||
|get column4
|
||||
|str find-replace '"' ''
|
||||
|str replace '"' ''
|
||||
}
|
||||
|
||||
def "nu-complete npm run" [] {
|
||||
|
|
|
@ -391,19 +391,19 @@ def "nu-complete winget uninstall package id" [] {
|
|||
}
|
||||
|
||||
def "nu-complete winget uninstall package name" [] {
|
||||
winget list | get name | str trim | str find-replace "…" "..."
|
||||
winget list | get name | str trim | str replace "…" "..."
|
||||
}
|
||||
|
||||
def "nu-complete winget install name" [] {
|
||||
let path = ($env.TMP | path join winget-packages.csv)
|
||||
|
||||
let completions = if ($path | path exists) && (ls $path | first | get modified | ((date now) - $in) < 1day) {
|
||||
open $path | get name | each { |it| $"(char dq)($it)(char dq)" } | str find-replace "…" ""
|
||||
open $path | get name | each { |it| $"(char dq)($it)(char dq)" } | str replace "…" ""
|
||||
} else {
|
||||
# Chinese characters break parsing, filter broken entries with `where source == winget`
|
||||
let data = (winget search | where source == winget | select name id)
|
||||
$data | save $path | ignore
|
||||
$data | get name | each { |it| $"(char dq)($it)(char dq)" } | str find-replace "…" ""
|
||||
$data | get name | each { |it| $"(char dq)($it)(char dq)" } | str replace "…" ""
|
||||
}
|
||||
{
|
||||
completions: $completions
|
||||
|
@ -418,12 +418,12 @@ def "nu-complete winget install id" [] {
|
|||
let path = ($env.TMP | path join winget-packages.csv)
|
||||
|
||||
if ($path | path exists) && (ls $path | first | get modified | ((date now) - $in) < 1day) {
|
||||
open $path | get id | str find-replace "…" ""
|
||||
open $path | get id | str replace "…" ""
|
||||
} else {
|
||||
# Chinese characters break parsing, filter broken entries with `where source == winget`
|
||||
let data = (winget search | where source == winget | select name id)
|
||||
$data | save $path | ignore
|
||||
$data | get id | str find-replace "…" ""
|
||||
$data | get id | str replace "…" ""
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue