1
Fork 0
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:
Darren Schroeder 2023-04-16 07:15:37 -05:00 committed by GitHub
parent 2d12532495
commit 87655ab380
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 7 additions and 7 deletions

View file

@ -33,7 +33,7 @@ def scoopInstalledAppsWithStar [] {
# list of all manifests from all buckets
def scoopAllApps [] {
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

View file

@ -9,7 +9,7 @@ def main [
] {
cargo llvm-cov show-env --export-prefix |
lines |
str substring '7,' |
str substring 7.. |
split column '=' |
str trim -c '"' |
transpose |

View file

@ -54,7 +54,7 @@ export-env {
def edit [action file] {
if 'NVIM' in ($env | columns) {
let af = ($file | each {|f|
if ($f|str substring ',1') in ['/', '~'] {
if ($f|str substring ..1) in ['/', '~'] {
$f
} else {
$"($env.PWD)/($f)"

View file

@ -51,7 +51,7 @@ export def path_abbrev_if_needed [apath term_width] {
if (($apath | str length) > ($term_width / 2)) {
# get all the tokens except the last
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
@ -71,7 +71,7 @@ export def path_abbrev_if_needed [apath term_width] {
let top_part = ($splits | first ($splits_len - 1))
let end_part = ($splits | last)
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)")
$tokens | skip 1 | str join $"($T)"

View file

@ -26,7 +26,7 @@ def home_abbrev [os_name] {
} else {
if ($os_name =~ "windows") {
# remove the C: from the path
$env.PWD | str replace -a '\\' '/' | str substring '2,'
$env.PWD | str replace -a '\\' '/' | str substring 2..
} else {
$env.PWD
}

View file

@ -77,7 +77,7 @@ export def repo-structured [] {
| split column ' ' col1 col2 full_hash
| get full_hash
| first
| str substring [0 7]
| str substring 0..7
} else {
''
})