#compdef atonal-util
#
# ZSH completion for atonal-util. Install to a $fpath directory.
# XXX --scaledegrees=anything is messing up subsequent completion
_atonal-util() {
_arguments \
'--flats[print notes as flats]' \
'(- *)--help[display help]' \
'--ly[emit notes not pitch numbers]' \
'(- *)--listmodes[show available modes]' \
'--scaledegrees=[degrees in the scale]' \
'*::atonal-util command:_atonalutil_mode'
}
_atonalutil_mode() {
_atonalutil_modes=(
'basic:prime_form and interval_class_content info' \
'circular_permute:all permutations of pitch set'
'complement:complement of set'
'equivs:Tn and TnI equivalents' \
'interval_class_content:ICC'
'invariance_matrix:invarience under TnI' \
'invariants:list of invariants of a given pitch set' \
'invert:inversion' \
'multiply:multiplication' \
'normal_form:normal_form' \
'pitch2intervalclass:pitch to interval class' \
'prime_form:prime_form' \
'recipe:list of methods to operate on a set with' \
'retrograde:reverse' \
'rotate:specific permutation' \
'set_complex:2D pitch set to inversion chart' \
'subsets:subsets of a given pitch set' \
'tcis:transposition inversion common-tone structure' \
'tcs:transposition common-tone structure' \
'transpose:Tn' \
'transpose_invert:TnI' \
'variances:intersection, difference, and union of two sets' \
'zrelation:whether two sets share same ICC'
)
if (( CURRENT == 1 )); then
_describe -t commands 'atonalutil command' _atonalutil_modes
else
local curcontext="$curcontext"
cmd="${_atonalutil_modes[(r)$words[1]:*]%%:*}"
if (( $#cmd )); then
curcontext="${curcontext%:*:*}:atonalutil-${cmd}:"
_call_function ret _atonalutil_$cmd || _message 'no more arguments'
else
_message "unknown atonalutil command: $words[1]"
fi
return ret
fi
}
# XXX too much copy-n-paste hereafter
_atonalutil_basic() {
_arguments -s \
'--flats[print notes as flats]' \
'--ly[emit notes not pitch numbers]'
}
_atonalutil_circular_permute() {
_arguments -s \
'--flats[print notes as flats]' \
'--ly[emit notes not pitch numbers]'
}
_atonalutil_complement() {
_arguments -s \
'--flats[print notes as flats]' \
'--ly[emit notes not pitch numbers]'
}
_atonalutil_equivs() {
_arguments -s \
'--flats[print notes as flats]' \
'--ly[emit notes not pitch numbers]'
}
_atonalutil_interval_class_content() { }
_atonalutil_invariance_matrix() { }
_atonalutil_invariants() {
_arguments -s \
'--flats[print notes as flats]' \
'--ly[emit notes not pitch numbers]'
}
_atonalutil_invert() {
_arguments -s \
'--axis=[inversion axis]:value:( )' \
'--flats[print notes as flats]' \
'--ly[emit notes not pitch numbers]'
}
_atonalutil_multiply() {
_arguments -s \
'--flats[print notes as flats]' \
'--ly[emit notes not pitch numbers]'
}
_atonalutil_normal_form() {
_arguments -s \
'--flats[print notes as flats]' \
'--ly[emit notes not pitch numbers]'
}
_atonalutil_pitch2intervalclass() {
_arguments -s \
'--flats[print notes as flats]' \
'--ly[emit notes not pitch numbers]'
}
_atonalutil_prime_form() {
_arguments -s \
'--flats[print notes as flats]' \
'--ly[emit notes not pitch numbers]'
}
_atonalutil_recipe() {
_arguments -s \
'--flats[print notes as flats]' \
'--ly[emit notes not pitch numbers]' \
'--file=[recipe file]:filename:_files'
}
_atonalutil_retrograde() {
_arguments -s \
'--flats[print notes as flats]' \
'--ly[emit notes not pitch numbers]'
}
_atonalutil_rotate() {
_arguments -s \
'--rotate=[rotate by]:value:( )' \
'--flats[print notes as flats]' \
'--ly[emit notes not pitch numbers]'
}
_atonalutil_set_complex() {
_arguments -s \
'--flats[print notes as flats]' \
'--ly[emit notes not pitch numbers]'
}
_atonalutil_set_complex() {
_arguments -s \
'--length=[length]:value:( )' \
'--flats[print notes as flats]' \
'--ly[emit notes not pitch numbers]'
}
_atonalutil_tcis() { }
_atonalutil_tcs() { }
_atonalutil_transpose() {
_arguments -s \
'--transpose=[transposition value]:value:( )' \
'--flats[print notes as flats]' \
'--ly[emit notes not pitch numbers]'
}
_atonalutil_transpose_invert() {
_arguments -s \
'--axis=[inversion axis]:value:( )' \
'--transpose=[transposition value]:value:( )' \
'--flats[print notes as flats]' \
'--ly[emit notes not pitch numbers]'
}
_atonalutil_variances() {
_arguments -s \
'--flats[print notes as flats]' \
'--ly[emit notes not pitch numbers]'
}
_atonalutil_zrelation() { }