From 677caa4bba414ad94b85dde2548cceb426b63e00 Mon Sep 17 00:00:00 2001 From: Thomas Forgione Date: Thu, 9 Nov 2023 12:15:45 +0100 Subject: [PATCH] Basic completion for pass --- nushell/config.nu | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/nushell/config.nu b/nushell/config.nu index 56fe97f..7c99a01 100644 --- a/nushell/config.nu +++ b/nushell/config.nu @@ -201,6 +201,31 @@ def _gclone_dirs [] { def-env cdg [key: string@_gclone_dirs] { cd (CLICOLOR_FORCE=1 pgd $key) } +# pass aliases / completion +def _pass_completion [] { + _ls ~/.password-store/**/* | each { |x| + if $x.type == "file" { + $x.name + | path parse + | update extension "" + | get parent stem + | str join "/" + } else { + $x.name + } + | split row '/' + | skip 4 + | str join "/" + } + | prepend git + | prepend insert +} + +export extern "pass" [ host?: string@_pass_completion ] + +alias p = pass +alias pc = pass --clip + # docker aliases alias ld = lazydocker alias dc = docker-compose @@ -248,8 +273,6 @@ alias kns = k9s alias :q = exit alias pdf = evince alias rg = rg -uu -alias p = pass -alias pc = pass --clip def-env mkcd [dir: string] { mkdir $dir; cd $dir } # Start tfetch