Skip to content

Commit

Permalink
Support command sequences in at-commands.mjs
Browse files Browse the repository at this point in the history
Fixes #363
  • Loading branch information
zcorpan committed Jun 1, 2021
1 parent e7212c4 commit 264861e
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions tests/resources/at-commands.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,19 @@ constructor(commands, support) {
let commands = [];

for (let c of commandsData) {
let command = keys[c[0]];
if (typeof command === 'undefined') {
throw new Error(`Key instruction identifier "${c}" for AT "${assistiveTech.name}", mode "${mode}", task "${task}" is not an available identified. Update you commands.json file to the correct identifier or add your identifier to resources/keys.mjs.`);
}
let innerCommands = [];
let commandSequence = c[0].split(',');
for (let command of commandSequence) {
command = keys[command];
if (typeof command === 'undefined') {
throw new Error(`Key instruction identifier "${c}" for AT "${assistiveTech.name}", mode "${mode}", task "${task}" is not an available identified. Update you commands.json file to the correct identifier or add your identifier to resources/keys.mjs.`);
}

let furtherInstruction = c[1];
command = furtherInstruction ? `${command} ${furtherInstruction}` : command;
commands.push(command);
let furtherInstruction = c[1];
command = furtherInstruction ? `${command} ${furtherInstruction}` : command;
innerCommands.push(command);
}
commands.push(innerCommands.join(' followed by '));
}

return commands;
Expand Down

0 comments on commit 264861e

Please sign in to comment.