-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from dwhinham/fish-completion
Add fish and zsh completion scripts and installation instructions in Readmes
- Loading branch information
Showing
5 changed files
with
179 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# mt32-pi-ctl fish completion script | ||
|
||
function __fish_list_midi_ports --description 'List available MIDI ports' | ||
if type -q aplaymidi | ||
aplaymidi -l | awk 'NR>1 {gsub(/^[[:space:]]+/, "", $1); print $1, $3}' FS='[[:space:]]{2,}' OFS='\t' | ||
end | ||
end | ||
|
||
complete -c mt32-pi-ctl -f | ||
complete -c mt32-pi-ctl -s h -l help -d "Display help." | ||
complete -c mt32-pi-ctl -s v -l verbose -d "Be verbose about what is going on." | ||
complete -c mt32-pi-ctl -s r -l reboot -d "Reboot the Pi. Will block for a few secs to give it time." | ||
complete -c mt32-pi-ctl -s p -x -a "(__fish_list_midi_ports)" -d "The ALSA MIDI client and port address to output to." | ||
complete -c mt32-pi-ctl -s m -l mt32 -d "Switch mt32-pi to MT-32 mode." | ||
complete -c mt32-pi-ctl -s g -l fluidsynth -d "Switch mt32-pi to FluidSynth mode." | ||
complete -c mt32-pi-ctl -s b -l romset -x -a "(echo -e \"old\tOld MT-32 (ROM v1.xx)\nnew\tNew MT-32 (ROM v2.xx)\ncm32l\tCM-32L\n\")" -d "Switch MT-32 romset." | ||
complete -c mt32-pi-ctl -s s -l soundfont -x -d "Set FluidSynth SoundFont. (number)" | ||
complete -c mt32-pi-ctl -s S -l mt32-rstereo -x -d "Enable/disable MT-32 reversed stereo. (0, 1)" | ||
complete -c mt32-pi-ctl -l mt32-reset -d "Send an MT-32 reset SysEx message." | ||
complete -c mt32-pi-ctl -l gm-reset -d "Send a GM reset SysEx message." | ||
complete -c mt32-pi-ctl -l gs-reset -d "Send a GS reset SysEx message." | ||
complete -c mt32-pi-ctl -s t -l mt32-txt -x -d "Send an MT-32 text display SysEx." | ||
complete -c mt32-pi-ctl -s T -l sc55-txt -x -d "Send an SC-55 text display SysEx." | ||
complete -c mt32-pi-ctl -s P -l sc55-bmp -r -d "Display a 16x16 1bpp BMP on the screen. (SC-55 SysEx)" | ||
complete -c mt32-pi-ctl -s X -l sc55-btxt -x -d "Display a string on the screen as a Bitmap. (SC-55)" | ||
complete -c mt32-pi-ctl -s N -l negative -n "__fish_contains_opt -s P sc55-bmp -s X sc55-btxt" -d "Reverse color. Use with '-P/--sc55-bmp' or '-X/--sc55-btxt'." | ||
complete -c mt32-pi-ctl -s M -l midi -x -d "Send a list of custom MIDI bytes." | ||
complete -c mt32-pi-ctl -s Y -l syx -r -d "Send the contents of a SYX-file." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#compdef mt32-pi-ctl | ||
_mt32-pi-ctl() { | ||
typeset -A opt_args | ||
local context state line | ||
|
||
_arguments -s -S \ | ||
"--help[Display help.]" \ | ||
"-v[Be verbose about what is going on.]" \ | ||
"--verbose[Be verbose about what is going on.]" \ | ||
"-b+[Switch MT-32 romset.]:romset:->romsets" \ | ||
"--romset[Switch MT-32 romset.]:romset:->romsets" \ | ||
"-p+[The ALSA MIDI client and port address to output to.]:midi-output:->midiports" \ | ||
"-r[Reboot the Pi. Will block for a few secs to give it time.]" \ | ||
"--reboot[Reboot the Pi. Will block for a few secs to give it time.]" \ | ||
"-m[Switch mt32-pi to MT-32 mode.]" \ | ||
"--mt32[Switch mt32-pi to MT-32 mode.]" \ | ||
"-g[Switch mt32-pi to FluidSynth mode.]" \ | ||
"--fluidsynth[Switch mt32-pi to FluidSynth mode.]" \ | ||
"-s+[Set FluidSynth SoundFont. (number)]:SoundFont number (0-255):" \ | ||
"--soundfont[Set FluidSynth SoundFont. (number)]:SoundFont number (0-255):" \ | ||
"-S+[Enable/disable MT-32 reversed stereo. (0, 1)]:1 or 0:->rstereo" \ | ||
"--mt32-rstereo[Enable/disable MT-32 reversed stereo. (0, 1)]:1 or 0:->rstereo" \ | ||
"--mt32-reset[Send an MT-32 reset SysEx message]" \ | ||
"--gm-reset[Send a GM reset SysEx message]" \ | ||
"--gs-reset[Send a GS reset SysEx message]" \ | ||
"--mt32-txt[Send an MT-32 text display SysEx]:some text:" \ | ||
"-t+[Send an MT-32 text display SysEx]:some text:" \ | ||
"--sc55-txt[Send an SC-55 text display SysEx]:some text:" \ | ||
"-T+[Send an SC-55 text display SysEx]:some text:" \ | ||
"--sc55-btxt[Display a string on the screen as a Bitmap. (SC-55)]:8 characters:" \ | ||
"-X+[Display a string on the screen as a Bitmap. (SC-55)]:8 characters:" \ | ||
"--sc55-bmp[Display a 16x16 1bpp BMP on the screen. (SC-55 SysEx)]:file:_files" \ | ||
"-P+[Display a 16x16 1bpp BMP on the screen. (SC-55 SysEx)]:file:_files" \ | ||
"-N[Reverse color. Use with '-P/--sc55-bmp' or '-X/--sc55-btxt'.]" \ | ||
"--negative[Reverse color. Use with '-P/--sc55-bmp' or '-X/--sc55-btxt'.]" \ | ||
"-M[Send a list of custom MIDI bytes (in hexadecimal).]:Hexadecimal Bytes:" \ | ||
"--midi[Send a list of custom MIDI bytes (in hexadecimal).]:Hexadecimal Bytes:" \ | ||
"-Y[Send the contents of a SYX-file.]:file:_files" \ | ||
"--syx[Send the contents of a SYX-file.]:file:_files" \ | ||
&& return 0 | ||
|
||
case $state in | ||
(midiports) | ||
if type aplaymidi > /dev/null 2>&1; then | ||
local midiports=$(aplaymidi -l | awk -F '[[:space:]][[:space:]]+' 'NR>1 { gsub(/^[ \t]+/,""); gsub(/:/,"\\:"); print $1":"$3 }') | ||
midiports=(${(ps:\n:)${midiports}}) | ||
_describe 'Available MIDI outputs' midiports && return 0 | ||
else | ||
return 0 | ||
fi | ||
;; | ||
(romsets) | ||
local romlist=('old:Old MT-32 (ROM v1.xx)' 'new:New MT-32 (ROM v2.xx)' 'cm32l:CM-32L') | ||
_describe 'romset' romlist && return 0 | ||
;; | ||
(rstereo) | ||
local desclist=('0:Disable reversed stereo' '1:Enable reversed stereo') | ||
_describe 'reversed stereo' desclist && return 0 | ||
;; | ||
esac | ||
|
||
return 1 | ||
} | ||
|
||
_mt32-pi-ctl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters