mirror of
https://github.com/Cian-H/dotfiles.git
synced 2026-03-09 22:58:05 +00:00
This change allows the dotfiles to work with chezmoi (e.g: on windows) and improves grepability with neovim/telescope
40 lines
978 B
Nu
40 lines
978 B
Nu
def pass_completions_directory [] {
|
|
if ($env | columns | any { |it| $it == "PASSWORD_STORE_DIR" }) {
|
|
return $env.PASSWORD_STORE_DIR
|
|
} else {
|
|
return ("~/.password-store" | path expand)
|
|
}
|
|
}
|
|
|
|
export def "nu-complete pass-files" [] {
|
|
let dir = (pass_completions_directory)
|
|
ls ($dir | path join "**" | path join "*.gpg")
|
|
| get name
|
|
| each {|it| ( $it
|
|
| path relative-to $dir
|
|
| str replace ".gpg" ""
|
|
)
|
|
}
|
|
}
|
|
|
|
export def "nu-complete pass-directories" [] {
|
|
let dir = (pass_completions_directory)
|
|
ls ($dir | path join **)
|
|
| get name
|
|
| filter { |it| not (ls $it | is-empty) }
|
|
| each {|it| ( $it | path relative-to $dir) }
|
|
}
|
|
|
|
export def "nu-complete pass-gpg" [] {
|
|
^gpg --list-keys
|
|
| lines
|
|
| skip 2
|
|
| split list ''
|
|
| each { |entry|
|
|
{
|
|
value: ($entry.1 | str trim),
|
|
description: ($entry.2 | parse --regex '^uid\s*\[[\w\s]*\]\s*(.*?)\s*$' | get 0.capture0)
|
|
}
|
|
}
|
|
}
|