summaryrefslogtreecommitdiff
path: root/.local/bin/shortcutgen
blob: 08164f03e16dd111899ea4cd0100b22adede80f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/bin/sh

# raw (basic processing before converting to specific formats)
#   - remove comments
#   - remove empty lines
#   - remove spacing (keep commas between columns)
#   - remove trailing whitespace

raw="$(sed 's/#.*//g;s/,\s*/,/g;/^$/d;s/\s*$//g' <"$XDG_CONFIG_HOME/shortcutrc")"

# lf
echo "$raw" | sed 's/\(.*\),\(.*\),\(.*\)/map g\2 cd \3/' >"$XDG_CONFIG_HOME/lf/shortcuts"

# shell (aliases and environment variables)
echo "$raw" | sed 's/\(.*\),\(.*\),\(.*\)/alias g\2="cd \3"\nexport G\U\2="\3"/' >"$HOME/.cache/zsh-shortcuts"