From 02976d182999c8108a5e0db5fc8633aaba1d6b08 Mon Sep 17 00:00:00 2001 From: BarbUk Date: Fri, 1 Feb 2019 10:39:51 +0400 Subject: [PATCH] Update snippy to execute bash script in scripts dir --- snippy | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/snippy b/snippy index d097ece..9312d0d 100755 --- a/snippy +++ b/snippy @@ -9,6 +9,7 @@ # . go up for block snippet for gui paste # . ##noparse header in snippet to not parse # . execute command begining by $ +# . execute bash script in $snippets_directory/scripts # # augmented by "opennomad": https://gist.github.com/opennomad/15c4d624dce99066a82d # originally written by "mhwombat": https://bbs.archlinux.org/viewtopic.php?id=71938&p=2 @@ -37,12 +38,6 @@ # TIP: If you're using XMonad, add something like this to xmonad.hs # ((mod4Mask, xK_s), spawn "/path/to/snippy") # -# 4. Set variables in ~/.snippy.conf. for example -# MENU_ENGINE="dmenu" -# DMENU_ARGS=' -p snippy -fn arial -sf green' -# ZENITY_ARGS='--list --hide-header --column=Snippet --text=snippy' -# GUIPASTE="xdotool key ctrl+v" -# CLIPASTE="xdotool key ctrl+shift+v" readonly snippets_directory=${HOME}/.snippy readonly MENU_ENGINE="rofi" @@ -122,6 +117,8 @@ run() { # don't parse file with the ##noparse header if grep -qE "^##noparse" "${snippets_directory}/${snippet}"; then content="$( tail -n +2 "${snippets_directory}/${snippet}" )" + elif [[ $(dirname "${snippet}") == 'scripts' ]] && grep -qE "^#!/bin/bash" "${snippets_directory}/${snippet}"; then + content="$( bash "${snippets_directory}/${snippet}" )" else content="$( bashdown < "${snippets_directory}/${snippet}" )" fi