add uxnget script
This commit is contained in:
parent
52632dc3c5
commit
4c1860a311
|
|
@ -0,0 +1,79 @@
|
|||
#!/bin/sh
|
||||
|
||||
function add_alias() {
|
||||
local alias_name="$1"
|
||||
local alias_cmd="$2"
|
||||
local shell_config
|
||||
local alias_line
|
||||
|
||||
case "$SHELL" in
|
||||
*/fish)
|
||||
shell_config="$HOME/.config/fish/config.fish"
|
||||
alias_line="alias $alias_name '$alias_cmd'"
|
||||
;;
|
||||
*/bash)
|
||||
shell_config="$HOME/.bashrc"
|
||||
alias_line="alias $alias_name='$alias_cmd'"
|
||||
;;
|
||||
*/zsh)
|
||||
shell_config="$HOME/.zshrc"
|
||||
alias_line="alias $alias_name='$alias_cmd'"
|
||||
;;
|
||||
*)
|
||||
echo "Unknown shell: $SHELL"
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ ! -f "$shell_config" ]; then
|
||||
mkdir -p "$(dirname "$shell_config")"
|
||||
touch "$shell_config"
|
||||
fi
|
||||
|
||||
if grep -q "^alias $alias_name" "$shell_config"; then
|
||||
echo "Alias '$alias_name' already exists in $shell_config"
|
||||
return
|
||||
fi
|
||||
|
||||
echo "$alias_line" >> "$shell_config"
|
||||
echo "Added alias '$alias_name' to $shell_config"
|
||||
}
|
||||
|
||||
gui_programs=(
|
||||
calendar
|
||||
notepad
|
||||
noodle
|
||||
oekaki
|
||||
turye
|
||||
theme
|
||||
left
|
||||
nasu
|
||||
nebu
|
||||
dexe
|
||||
cccc
|
||||
m291
|
||||
drif
|
||||
)
|
||||
|
||||
cli_programs=(
|
||||
drifblim
|
||||
drifloon
|
||||
uxnfor
|
||||
uxnlin
|
||||
hx
|
||||
)
|
||||
|
||||
for s in "${gui_programs[@]}"; do
|
||||
echo "$s.tal.txt > $s.rom"
|
||||
wget -qP /tmp "https://wiki.xxiivv.com/etc/$s.tal.txt"
|
||||
uxnasm "/tmp/$s.tal.txt" "$HOME/roms/uxn/$s.rom"
|
||||
add_alias "$s" "uxn11 $HOME/roms/uxn/$s.rom"
|
||||
done
|
||||
|
||||
for s in "${cli_programs[@]}"; do
|
||||
echo "$s.tal.txt > $s.rom"
|
||||
wget -qP /tmp "https://wiki.xxiivv.com/etc/$s.tal.txt"
|
||||
uxnasm "/tmp/$s.tal.txt" "$HOME/roms/uxn/$s.rom"
|
||||
add_alias "$s" "uxncli $HOME/roms/uxn/$s.rom"
|
||||
done
|
||||
|
||||
Loading…
Reference in New Issue