Added CLI helper to print invalid options errors for commands.

This commit is contained in:
Jonathan Bernard 2016-03-21 01:13:44 -05:00
parent 3d65a47781
commit 72b4b0c9ff

View File

@ -454,11 +454,7 @@ Configuration:
modelClass = modelClasses[Matcher.lastMatcher[0][1]]
return library.getWhere(modelClass, [playlistId: playQueue.id])
case ~/untagged files/: return library.untaggedFiles
default:
logger.debug("Invalid select options: $options")
err "Invalid options to the ${cmdStyle}select${normalStyle}" +
" command. Use ${cmdStyle}help select${normalStyle} to " +
"see a list of valid options." } }
default: invalidOptionsErr('select') } }
private Playlist processPlay(String options, List<Model> selection) {
@ -1040,7 +1036,6 @@ Play and Controlling Media:
Playlist and Queue Management:
scan
enqueue selection
enqueue <selection-criteria>
@ -1063,6 +1058,9 @@ Playlist and Queue Management:
clear selection
clear playlist <id | name>
Library Management:
scan
"""
default:
@ -1071,6 +1069,11 @@ Playlist and Queue Management:
Thread.sleep(250)
break } }
private String invalidOptionsErr(String commandName) {
err "Invalid options to the ${cmdStyle}${commandName}${normalStyle}" +
" command. Use ${cmdStyle}help ${commandName}${normalStyle} to " +
"see a list of valid options." }
private void playing(def player) {
try {
def mediaFiles = library.getMediaFilesWhere(playlistId: playQueue.id)