This commit is contained in:
Thomas Forgione 2023-11-20 10:39:11 +01:00
parent b326eb92d7
commit a48d63a441
1 changed files with 6 additions and 4 deletions

View File

@ -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)