Fix cdg
This commit is contained in:
parent
b326eb92d7
commit
a48d63a441
|
@ -11,8 +11,12 @@ def _gclone_dirs [] {
|
||||||
}
|
}
|
||||||
|
|
||||||
def --env cdg [key: string@_gclone_dirs] {
|
def --env cdg [key: string@_gclone_dirs] {
|
||||||
|
|
||||||
|
let slashes = ($env.GCLONE_PATH | split row "/" | length) + 3
|
||||||
|
|
||||||
let dir = _ls ($env.GCLONE_PATH + "/**")
|
let dir = _ls ($env.GCLONE_PATH + "/**")
|
||||||
| where { ($in.name | path basename) == $key }
|
| where { $in != null and ($in.name | split row "/" | length) <= $slashes and ($in.name | path basename) == $key }
|
||||||
|
|
||||||
|
|
||||||
match ($dir | length) {
|
match ($dir | length) {
|
||||||
0 => {
|
0 => {
|
||||||
|
@ -25,7 +29,7 @@ def --env cdg [key: string@_gclone_dirs] {
|
||||||
}
|
}
|
||||||
|
|
||||||
1 => {
|
1 => {
|
||||||
cd ($dir.name)
|
cd $dir.0.name
|
||||||
}
|
}
|
||||||
|
|
||||||
_ => {
|
_ => {
|
||||||
|
@ -34,8 +38,6 @@ def --env cdg [key: string@_gclone_dirs] {
|
||||||
(ansi reset) + " multiple entries found, please select one"
|
(ansi reset) + " multiple entries found, please select one"
|
||||||
)
|
)
|
||||||
|
|
||||||
echo $dir
|
|
||||||
|
|
||||||
print (
|
print (
|
||||||
(ansi --escape 'A') +
|
(ansi --escape 'A') +
|
||||||
(ansi attr_bold) + "Enter your choice: " + (ansi reset)
|
(ansi attr_bold) + "Enter your choice: " + (ansi reset)
|
||||||
|
|
Loading…
Reference in New Issue