diff options
Diffstat (limited to 'scripts/format.sh')
-rwxr-xr-x | scripts/format.sh | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/scripts/format.sh b/scripts/format.sh index d9db529..c93fb3b 100755 --- a/scripts/format.sh +++ b/scripts/format.sh @@ -4,11 +4,25 @@ root="$(git rev-parse --show-toplevel)" final="$(mktemp)" -format "$root/src/keymaps/soispha/layout/keymap.h" > "$final" +mode="$1" +target="/dev/null" -git add "$root/src/keymaps/soispha/layout/keymap.h" +if [ "$mode" = "keymap.h" ]; then + target="$root/src/keymaps/soispha/layout/keymap.h" +elif [ "$mode" = "ledmap.h" ]; then + target="$root/src/keymaps/soispha/led/ledlayout.h" +elif [ "$mode" = "translation.h" ]; then + target="$root/src/keymaps/soispha/led/translation.h" + mode="ledmap.h" +else + echo "$mode" is invalid + exit 2 +fi -cat "$final" > "$root/src/keymaps/soispha/layout/keymap.h" +format "$mode" "$target" >"$final" +git add "$target" + +cat "$final" >"$target" rm "$final" # vim: ft=sh |