Add pet snippet management

This commit is contained in:
Lockszmith (@VAST) 2025-03-10 16:24:24 -04:00
parent 58e921ac4c
commit 20555a91c9
7 changed files with 79 additions and 0 deletions

View File

@ -56,6 +56,18 @@
{{- end -}}
{{- end -}}
{{- with $repo := "knqyf263/pet" -}}
{{- with $version := trimPrefix "v" (gitHubLatestRelease $repo).GetTagName -}}
{{- $_ := set $externals ".local/bin/pet" (dict
"type" "archive-file"
"url" (printf "https://github.com/%s/releases/download/v%s/pet_%s_%s.tar.gz" $repo $version $version $myArch)
"path" "pet"
"executable" true
"refreshPeriod" $defaultRefresh
) -}}
{{- end -}}
{{- end -}}
{{ $myArch = "mac" }}
{{- with $repo := "extrawurst/gitui" -}}

View File

@ -0,0 +1 @@
../../../_src.posix/private_dot_config/pet/config.toml

View File

@ -0,0 +1 @@
../../../_src.posix/private_dot_config/pet/snippet.toml

View File

@ -0,0 +1 @@
../../../_src.posix/private_dot_config/sz.env/zza_pet.env

View File

@ -0,0 +1,37 @@
[General]
Backend = "gist" # specify backend service to sync snippets (gist, ghe or gitlab, default: gist)
cmd = ["sh", "-c"] # specify the command to execute the snippet with
Color = false # enables output coloring with fzf, same as '--color' flag
Column = 40 # column size for list command
Editor = "vim" # your favorite text editor
Format = "[$description]: $command $tags" # controls the format of the output when searching
SelectCmd = "fzf --ansi --layout=reverse --border --height=90% --pointer=* --cycle --prompt=Snippets:" # selector command for edit command (fzf or peco)
SnippetDirs = []
SnippetFile = "/Users/gal.szkolnik/.config/pet/snippet.toml" # specify snippet path
SortBy = "" # specify how snippets get sorted (recency (default), -recency, description, -description, command, -command, output, -output)
[Gist]
file_name = "pet-snippet.toml"
access_token = "" # your access token
gist_id = "" # Gist ID
Public = false # public or priate
auto_sync = false # sync automatically when editing snippets
[GitLab]
file_name = "pet-snippet.toml" # specify GitLab Snippets file name
access_token = "XXXXXXXXXXXXX" # your access token
ID = "" # GitLab Snippets ID
Visibility = "private" # public or internal or private
auto_sync = false # sync automatically when editing snippets
Url = ""
skip_ssl = false
[GHEGist]
Public = false
access_token = ""
auto_sync = false
base_url = ""
file_name = ""
gist_id = ""
upload_url = ""

View File

@ -0,0 +1,18 @@
[[Snippets]]
Description = "shell's nil"
Output = ""
Tag = []
command = ": ;"
[[Snippets]]
Description = "echo"
Output = ""
Tag = []
command = "echo"
[[Snippets]]
Description = "Initialize MacBook Pro connection into TechPort"
Output = ""
Tag = []
command = "lsif\nlsip\npull-vast.id_rsa 0\nvastconnect 192.168.2.2\nauto-copy-ssh-id 192.168.2.2"

View File

@ -0,0 +1,9 @@
#!/usr/bin/env -S bash -c 'echo "Not a user script. source(aka .) only"'
BASE_SHELL=${BASE_SHELL:-${SHELL##*/}}
if is_cmd pet; then
. <( pet completion ${BASE_SHELL} )
[[ -n "${DBG}" ]] && echo "pet loaded."
fi