- ReservedWords =
%w[
connect exit workspace workspaces disconnect
]
- ReservedWorkspaceWords =
%w[
cueLists selectedCues runningCues runningOrPausedCues thump
]
- ReservedCueWords =
%w[
cue stop pause resume load preview reset panic loadAt uniqueID
hasFileTargets hasCueTargets allowsEditingDuration isLoaded isRunning
isPaused isBroken preWaitElapsed actionElapsed postWaitElapsed
percentPreWaitElapsed percentActionElapsed percentPostWaitElapsed
type number name notes cueTargetNumber cueTargetId preWait duration
postWait continueMode flagged armed colorName basics children
sliderLevel sliderLevels
]
- CompletionProc =
Proc.new {|input|
matcher = /^#{Regexp.escape(input)}/
commands = ReservedWords.grep(matcher)
if Qcmd.connected?
if Qcmd.context.workspace_connected?
cue_numbers = Qcmd.context.workspace.cues.map(&:number)
commands = commands +
cue_numbers.grep(matcher) +
ReservedCueWords.grep(matcher) +
ReservedWorkspaceWords.grep(matcher)
else
names = Qcmd.context.machine.workspace_names
quoted_names = names.map {|wn| %["#{wn}"]}
workspace_names = (names + quoted_names).grep(matcher)
workspace_names = workspace_names.map {|wsn|
if / / =~ wsn && /"/ !~ wsn
%["#{ wsn }"]
else
wsn
end
}
commands = commands + workspace_names
end
else
machine_names = Qcmd::Network.names
quoted_names = machine_names.map {|mn| %["#{mn}"]}
names = (quoted_names + machine_names).grep(matcher)
names = names.map {|wsn|
if / / =~ wsn && /"/ !~ wsn
%["#{ wsn }"]
else
wsn
end
}
commands = commands + names
end
commands
}