More efficient cdg
This commit is contained in:
parent
9ce46b5211
commit
5140316764
|
@ -1,21 +1,19 @@
|
|||
# gclone aliases
|
||||
def _gclone_dirs [] {
|
||||
let slashes = ($env.GCLONE_PATH | split row "/" | length) + 3
|
||||
|
||||
_ls ($env.GCLONE_PATH + "/**")
|
||||
| each { $in.name }
|
||||
| where { ($in | split row "/" | length) <= $slashes }
|
||||
| each { $in | split row "/" | last }
|
||||
def _gclone_dirs [] {
|
||||
_ls ($env.GCLONE_PATH + "/*")
|
||||
| append (_ls ($env.GCLONE_PATH + "/*/*"))
|
||||
| append (_ls ($env.GCLONE_PATH + "/*/*/*"))
|
||||
| each { $in.name | path basename }
|
||||
| sort
|
||||
| uniq
|
||||
}
|
||||
|
||||
def --env cdg [key: string@_gclone_dirs] {
|
||||
|
||||
let slashes = ($env.GCLONE_PATH | split row "/" | length) + 3
|
||||
|
||||
let dir = _ls ($env.GCLONE_PATH + "/**")
|
||||
| where { $in != null and ($in.name | split row "/" | length) <= $slashes and ($in.name | path basename) == $key }
|
||||
let dir = _ls ($env.GCLONE_PATH + "/*")
|
||||
| append (_ls ($env.GCLONE_PATH + "/*/*"))
|
||||
| append (_ls ($env.GCLONE_PATH + "/*/*/*"))
|
||||
| where { $in != null and ($in.name | path basename) == $key }
|
||||
|
||||
|
||||
match ($dir | length) {
|
||||
|
@ -38,6 +36,8 @@ def --env cdg [key: string@_gclone_dirs] {
|
|||
(ansi reset) + " multiple entries found, please select one"
|
||||
)
|
||||
|
||||
echo $dir
|
||||
|
||||
print (
|
||||
(ansi --escape 'A') +
|
||||
(ansi attr_bold) + "Enter your choice: " + (ansi reset)
|
||||
|
|
Loading…
Reference in New Issue