30 lines
602 B
Plaintext
30 lines
602 B
Plaintext
export def load [] {
|
|
if ("~/.nu_bookmarks.csv" | path exists) {
|
|
open ~/.nu_bookmarks.csv
|
|
} else {
|
|
[]
|
|
}
|
|
}
|
|
|
|
export def get-completion [] {
|
|
load | rename description value
|
|
}
|
|
|
|
def save-bookmarks [] {
|
|
uniq | save -f "~/.nu_bookmarks.csv"
|
|
}
|
|
|
|
export def add [] {
|
|
load | append {path: (pwd), name: (pwd | path basename)} | save-bookmarks
|
|
}
|
|
|
|
export def find [name:string@get-completion] {
|
|
load | where name == $name | last | get path
|
|
}
|
|
|
|
export def-env main [name:string@get-completion] {
|
|
let dest = (load | where name == $name | last | get path)
|
|
cd $dest
|
|
}
|
|
|