mirror of
https://github.com/RGBCube/nu_scripts
synced 2025-08-02 07:07:46 +00:00
update range syntax in str substring usage (#448)
This commit is contained in:
parent
2d12532495
commit
87655ab380
6 changed files with 7 additions and 7 deletions
|
@ -33,7 +33,7 @@ def scoopInstalledAppsWithStar [] {
|
||||||
# list of all manifests from all buckets
|
# list of all manifests from all buckets
|
||||||
def scoopAllApps [] {
|
def scoopAllApps [] {
|
||||||
let bucketsDir = if ('SCOOP' in (env).name) { [ (getenv 'SCOOP'), 'buckets' ] | path join } else { [ (getenv 'USERPROFILE'), 'scoop', 'buckets' ] | path join }
|
let bucketsDir = if ('SCOOP' in (env).name) { [ (getenv 'SCOOP'), 'buckets' ] | path join } else { [ (getenv 'USERPROFILE'), 'scoop', 'buckets' ] | path join }
|
||||||
(ls -s $bucketsDir | get name) | each {|bucket| ls ([$bucketsDir, $bucket, 'bucket', '*.json'] | str join '\') | get name | path basename | str substring ',-5' } | flatten | uniq
|
(ls -s $bucketsDir | get name) | each {|bucket| ls ([$bucketsDir, $bucket, 'bucket', '*.json'] | str join '\') | get name | path basename | str substring ..-5 } | flatten | uniq
|
||||||
}
|
}
|
||||||
|
|
||||||
# list of all apps that are not installed
|
# list of all apps that are not installed
|
||||||
|
|
|
@ -9,7 +9,7 @@ def main [
|
||||||
] {
|
] {
|
||||||
cargo llvm-cov show-env --export-prefix |
|
cargo llvm-cov show-env --export-prefix |
|
||||||
lines |
|
lines |
|
||||||
str substring '7,' |
|
str substring 7.. |
|
||||||
split column '=' |
|
split column '=' |
|
||||||
str trim -c '"' |
|
str trim -c '"' |
|
||||||
transpose |
|
transpose |
|
||||||
|
|
|
@ -54,7 +54,7 @@ export-env {
|
||||||
def edit [action file] {
|
def edit [action file] {
|
||||||
if 'NVIM' in ($env | columns) {
|
if 'NVIM' in ($env | columns) {
|
||||||
let af = ($file | each {|f|
|
let af = ($file | each {|f|
|
||||||
if ($f|str substring ',1') in ['/', '~'] {
|
if ($f|str substring ..1) in ['/', '~'] {
|
||||||
$f
|
$f
|
||||||
} else {
|
} else {
|
||||||
$"($env.PWD)/($f)"
|
$"($env.PWD)/($f)"
|
||||||
|
|
|
@ -51,7 +51,7 @@ export def path_abbrev_if_needed [apath term_width] {
|
||||||
if (($apath | str length) > ($term_width / 2)) {
|
if (($apath | str length) > ($term_width / 2)) {
|
||||||
# get all the tokens except the last
|
# get all the tokens except the last
|
||||||
let tokens = ($splits | take ($splits_len - 1) | each {|x|
|
let tokens = ($splits | take ($splits_len - 1) | each {|x|
|
||||||
$"($T)($x | str substring 0,1)($R)"
|
$"($T)($x | str substring 0..1)($R)"
|
||||||
})
|
})
|
||||||
|
|
||||||
# append the last part of the path
|
# append the last part of the path
|
||||||
|
@ -71,7 +71,7 @@ export def path_abbrev_if_needed [apath term_width] {
|
||||||
let top_part = ($splits | first ($splits_len - 1))
|
let top_part = ($splits | first ($splits_len - 1))
|
||||||
let end_part = ($splits | last)
|
let end_part = ($splits | last)
|
||||||
let tokens = ($top_part | each {|x|
|
let tokens = ($top_part | each {|x|
|
||||||
$"/($T)($x | str substring 0,1)($R)"
|
$"/($T)($x | str substring 0..1)($R)"
|
||||||
})
|
})
|
||||||
let tokens = ($tokens | append $"/($PB)($end_part)($R)")
|
let tokens = ($tokens | append $"/($PB)($end_part)($R)")
|
||||||
$tokens | skip 1 | str join $"($T)"
|
$tokens | skip 1 | str join $"($T)"
|
||||||
|
|
|
@ -26,7 +26,7 @@ def home_abbrev [os_name] {
|
||||||
} else {
|
} else {
|
||||||
if ($os_name =~ "windows") {
|
if ($os_name =~ "windows") {
|
||||||
# remove the C: from the path
|
# remove the C: from the path
|
||||||
$env.PWD | str replace -a '\\' '/' | str substring '2,'
|
$env.PWD | str replace -a '\\' '/' | str substring 2..
|
||||||
} else {
|
} else {
|
||||||
$env.PWD
|
$env.PWD
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,7 +77,7 @@ export def repo-structured [] {
|
||||||
| split column ' ' col1 col2 full_hash
|
| split column ' ' col1 col2 full_hash
|
||||||
| get full_hash
|
| get full_hash
|
||||||
| first
|
| first
|
||||||
| str substring [0 7]
|
| str substring 0..7
|
||||||
} else {
|
} else {
|
||||||
''
|
''
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue