Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unset -f sc
- function sc_preview() {
- d="$1"
- f=$(basename $d)
- icon=$(basename $(ls $d/icon-[PD]*))
- icon=${icon##icon-[PD]}
- grep "\.dev" $d/config.yaml > /dev/null
- if [ $? -eq 0 ] ; then
- echo "[32mDEV $icon [0m"
- else
- echo "[31mPROD $icon [0m"
- fi
- if [ -f $d/strm-creds*.json ] ; then
- cat $d/strm-creds*.json | jq -r .email
- else
- echo "not logged in"
- fi
- echo $f
- cat $d/config.yaml | sed -e 's/^#.*/[2m&[0m/g'
- }
- export -f sc_preview
- function sc() {
- cd ~/.config
- eval "p=$(find . -name icon-[PD]* | xargs dirname | xargs basename -a | fzf --preview \
- 'sc_preview {}' \
- --preview-window=right:75%:wrap)"
- if [ ! -z "$p" ] ; then
- export STRM_CONFIG_PATH=$(realpath $p)
- fi
- cd - > /dev/null
- echo "STRM_CONFIG_PATH=$STRM_CONFIG_PATH"
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement