File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -595,3 +595,29 @@ jgl() {
595595 jj git fetch
596596 jj new " $b "
597597}
598+
599+ # ----------------
600+
601+ # cat and copy to clipboard a prompt file under the prompts directory.
602+ # If an argument is given, it is used as a prefix to find the prompt file.
603+ # If no argument is given, lists available prompt files without extensions.
604+ prompt () {
605+ local dir=" $HOME /Desktop/interface/doc/prompts"
606+ if [[ -n " $1 " ]]; then
607+ local file
608+ file=$( find " $dir " -maxdepth 1 -type f -name " $1 *" | head -1)
609+
610+ if [[ -n " $file " ]]; then
611+ command cat " $file "
612+ pbc < <( cat " $file " )
613+ else
614+ while IFS= read -r f; do
615+ basename " $f " | sed ' s/\.[^.]*$//'
616+ done < <( find " $dir " -maxdepth 1 -type f)
617+ fi
618+ else
619+ while IFS= read -r f; do
620+ basename " $f " | sed ' s/\.[^.]*$//'
621+ done < <( find " $dir " -maxdepth 1 -type f)
622+ fi
623+ }
You can’t perform that action at this time.
0 commit comments