From 9991e791dd5b6f12e2dcf4b691c3ec9ba09989dc Mon Sep 17 00:00:00 2001 From: Jason Swank Date: Sun, 19 Jan 2025 21:20:57 +0000 Subject: [PATCH] add aichat, zsh completion dir --- install.sh | 3 +- ssh/.ssh/known_hosts | 3 ++ ssh/.ssh/known_hosts.old | 1 + zsh/.local/share/zsh/functions/_go_task | 1 + zsh/.local/share/zsh/functions/_task | 71 +++++++++++++++++++++++++ zsh/.zshrc | 6 +-- 6 files changed, 81 insertions(+), 4 deletions(-) create mode 100644 ssh/.ssh/known_hosts create mode 100644 ssh/.ssh/known_hosts.old create mode 120000 zsh/.local/share/zsh/functions/_go_task create mode 100644 zsh/.local/share/zsh/functions/_task diff --git a/install.sh b/install.sh index 2607142..a19e971 100755 --- a/install.sh +++ b/install.sh @@ -34,7 +34,8 @@ for dir in \ sh \ ssh \ tmux \ - zsh + zsh \ + aichat do $STOW -t $HOME $dir done diff --git a/ssh/.ssh/known_hosts b/ssh/.ssh/known_hosts new file mode 100644 index 0000000..330020e --- /dev/null +++ b/ssh/.ssh/known_hosts @@ -0,0 +1,3 @@ +192.168.101.110 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJb5kemGOPwXoNr09PqIEZbHjZprJUrEtHOKk4jvxAlH +192.168.101.110 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD3MkIlJXiY/CF1Q9l+C1b5jKj05cIzr7AMTHXLnkvrGZD/n2XwkYKTVIwgiGm4de2MKs1tcFJU4l5y6ARWu2Iit7UHC7Zk9aAydg59przJV/aj9pkLfOYKvWu6f7VGWEMTzy+FZ+7C+ulzIhhV6fN6sDO6Ywa5Pkl/LyXlSWHlfWO7xVYFQwRaACdhdnjl+tygXWISHErtCUXX8qR+c7+yyb/tNKF67yhDX+U55PkMDoHqtQDVAYotUukvHZ4SbE//rTt/xRQAb/GnRV2f4p+Zl65UGBNr7Wh8oRWAdRx/CjU8ujgEZgs99lKLkAUdNz/52eAvoIxccoOdIkbk0snv +192.168.101.110 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBHZCtwh3lEIVtg/rm4p2Lws2zjXbvB8K8hk4ymagckaRdYq/16TqB8A2ki28fkGh7+DmitaCEC+iW/4lcQtEvsQ= diff --git a/ssh/.ssh/known_hosts.old b/ssh/.ssh/known_hosts.old new file mode 100644 index 0000000..d322cc9 --- /dev/null +++ b/ssh/.ssh/known_hosts.old @@ -0,0 +1 @@ +192.168.101.110 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJb5kemGOPwXoNr09PqIEZbHjZprJUrEtHOKk4jvxAlH diff --git a/zsh/.local/share/zsh/functions/_go_task b/zsh/.local/share/zsh/functions/_go_task new file mode 120000 index 0000000..79ac75c --- /dev/null +++ b/zsh/.local/share/zsh/functions/_go_task @@ -0,0 +1 @@ +_task \ No newline at end of file diff --git a/zsh/.local/share/zsh/functions/_task b/zsh/.local/share/zsh/functions/_task new file mode 100644 index 0000000..50fad03 --- /dev/null +++ b/zsh/.local/share/zsh/functions/_task @@ -0,0 +1,71 @@ +#compdef task +compdef _task task +typeset -A opt_args + +_GO_TASK_COMPLETION_LIST_OPTION="${GO_TASK_COMPLETION_LIST_OPTION:---list-all}" + +# Listing commands from Taskfile.yml +function __task_list() { + local -a scripts cmd + local -i enabled=0 + local taskfile item task desc + + cmd=(task) + taskfile=${(Qv)opt_args[(i)-t|--taskfile]} + taskfile=${taskfile//\~/$HOME} + + + if [[ -n "$taskfile" && -f "$taskfile" ]]; then + enabled=1 + cmd+=(--taskfile "$taskfile") + else + for taskfile in {T,t}askfile{,.dist}.{yaml,yml}; do + if [[ -f "$taskfile" ]]; then + enabled=1 + break + fi + done + fi + + (( enabled )) || return 0 + + scripts=() + for item in "${(@)${(f)$("${cmd[@]}" $_GO_TASK_COMPLETION_LIST_OPTION)}[2,-1]#\* }"; do + task="${item%%:[[:space:]]*}" + desc="${item##[^[:space:]]##[[:space:]]##}" + scripts+=( "${task//:/\\:}:$desc" ) + done + _describe 'Task to run' scripts +} + +_task() { + _arguments \ + '(-C --concurrency)'{-C,--concurrency}'[limit number of concurrent tasks]: ' \ + '(-p --parallel)'{-p,--parallel}'[run command-line tasks in parallel]' \ + '(-f --force)'{-f,--force}'[run even if task is up-to-date]' \ + '(-c --color)'{-c,--color}'[colored output]' \ + '(-d --dir)'{-d,--dir}'[dir to run in]:execution dir:_dirs' \ + '(--dry)--dry[dry-run mode, compile and print tasks only]' \ + '(-o --output)'{-o,--output}'[set output style]:style:(interleaved group prefixed)' \ + '(--output-group-begin)--output-group-begin[message template before grouped output]:template text: ' \ + '(--output-group-end)--output-group-end[message template after grouped output]:template text: ' \ + '(-s --silent)'{-s,--silent}'[disable echoing]' \ + '(--status)--status[exit non-zero if supplied tasks not up-to-date]' \ + '(--summary)--summary[show summary\: field from tasks instead of running them]' \ + '(-t --taskfile)'{-t,--taskfile}'[specify a different taskfile]:taskfile:_files' \ + '(-v --verbose)'{-v,--verbose}'[verbose mode]' \ + '(-w --watch)'{-w,--watch}'[watch-mode for given tasks, re-run when inputs change]' \ + + '(operation)' \ + {-l,--list}'[list describable tasks]' \ + {-a,--list-all}'[list all tasks]' \ + {-i,--init}'[create new Taskfile.yml]' \ + '(-*)'{-h,--help}'[show help]' \ + '(-*)--version[show version and exit]' \ + '*: :__task_list' +} + +# don't run the completion function when being source-ed or eval-ed +if [ "$funcstack[1]" = "_task" ]; then + _task "$@" +fi + diff --git a/zsh/.zshrc b/zsh/.zshrc index 40adb3d..c410752 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -4,6 +4,8 @@ alias vim='nvim' alias vi='nvim' alias w3='w3m -T text/html' +fpath+=~/.local/share/zsh/functions + path+=(~/bin) path+=(~/.local/bin) path+=($GOPATH/bin) @@ -12,8 +14,6 @@ export PATH # allow for # to be interpreted as a comment on the command line setopt interactivecomments -# cd tricks -alias -- -='cd -' setopt auto_cd # there is no binary by that name in your $PATH, your shell will cd into it that directory # use vi-style keymap @@ -87,7 +87,7 @@ if [ -e $HOME/cfa-work/.zshrc ]; then . $HOME/cfa-work/.zshrc fi -for env in $HOME/.okta/.env $HOME/.aws/.env $HOME/.config/git/.env; do +for env in $HOME/.okta/.env $HOME/.aws/.env $HOME/.config/github/.env $HOME/.config/aichat/.env; do if [ -r $env ]; then export $(xargs < $env) fi