diff options
Diffstat (limited to 'fms.sh')
-rwxr-xr-x | fms.sh | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -14,9 +14,9 @@ done SWITCH_MENU=$(mktemp) function update() { - touch commands.state - if [[ "$(stat -c%Y commands.yaml)" != "$(cat commands.state)" ]] || [[ $1 == "force" ]]; then - cat /dev/null >commands.raw + touch data/commands.state + if [[ "$(stat -c%Y data/commands.yaml)" != "$(cat data/commands.state)" ]] || [[ $1 == "force" ]]; then + cat /dev/null >data/commands.raw i=1 #set -eux while read -r line; do @@ -28,15 +28,15 @@ function update() { echo "Error on line: ${line}" exit fi - echo "${cmd} # [${tags} ${lang} ${i}] ${desc}" | tee -a commands.tmp.${lang} >/dev/null + echo "${cmd} # [${tags} ${lang} ${i}] ${desc}" | tee -a data/commands.tmp.${lang} >/dev/null i=$(($i + 1)) - done < <(cat commands.yaml | yq e -o=j -I=0 .commands[]) - for filename in $(ls -t commands.tmp.*); do + done < <(cat data/commands.yaml | yq e -o=j -I=0 .commands[]) + for filename in $(ls -t data/commands.tmp.*); do lang=$(echo ${filename} | rev | cut -d'.' -f1 | rev) - cat ${filename} | bat --color=always -l ${lang} -pp >>commands.raw + cat ${filename} | bat --color=always -l ${lang} -pp >>data/commands.raw rm -f ${filename} done - stat -c%Y commands.yaml >commands.state + stat -c%Y data/commands.yaml >data/commands.state fi } @@ -44,7 +44,7 @@ function notes() { update echo -n 0 >${SWITCH_MENU} unset RES - RES=$(cat commands.raw | sk --reverse --ansi --inline-info \ + RES=$(cat data/commands.raw | sk --reverse --ansi --inline-info \ --bind "shift-left:execute-silent(echo -n 1 > ${SWITCH_MENU})+abort" \ --bind "shift-right:execute-silent(echo -n 1 > ${SWITCH_MENU})+abort") SWITCH=$(cat ${SWITCH_MENU}) |