summary refs log tree commit diff stats
path: root/scripts/format.sh
blob: c93fb3b6a2ccb738ede7979407270be1fd3804b7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env sh

root="$(git rev-parse --show-toplevel)"

final="$(mktemp)"

mode="$1"
target="/dev/null"

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

format "$mode" "$target" >"$final"
git add "$target"

cat "$final" >"$target"
rm "$final"

# vim: ft=sh