|
@@ -58,6 +58,8 @@ namespace CommandIDs {
|
|
|
|
|
|
export const runFirstEnabled = 'apputils:run-first-enabled';
|
|
|
|
|
|
+ export const runAllEnabled = 'apputils:run-all-enabled';
|
|
|
+
|
|
|
export const toggleHeader = 'apputils:toggle-header';
|
|
|
}
|
|
|
|
|
@@ -568,6 +570,27 @@ const utilityCommands: JupyterFrontEndPlugin<void> = {
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
+
|
|
|
+ commands.addCommand(CommandIDs.runAllEnabled, {
|
|
|
+ label: trans.__('Run All Enabled Commands Passed as Args'),
|
|
|
+ execute: args => {
|
|
|
+ const commands: string[] = args.commands as string[];
|
|
|
+ const commandArgs: any = args.args;
|
|
|
+ const argList = Array.isArray(args);
|
|
|
+ const errorIfNotEnabled: boolean = args.errorIfNotEnabled as boolean;
|
|
|
+ for (let i = 0; i < commands.length; i++) {
|
|
|
+ const cmd = commands[i];
|
|
|
+ const arg = argList ? commandArgs[i] : commandArgs;
|
|
|
+ if (app.commands.isEnabled(cmd, arg)) {
|
|
|
+ app.commands.execute(cmd, arg);
|
|
|
+ } else {
|
|
|
+ if (errorIfNotEnabled) {
|
|
|
+ console.error(`${cmd} is not enabled.`);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
};
|
|
|
|