MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / cmdSet

Method cmdSet

tools/xsbug-log/xsbug-debugmachine.js:2744–2805  ·  view source on GitHub ↗
(args)

Source from the content-addressed store, hash-verified

2742 }
2743
2744 cmdSet(args) {
2745 if (args.length === 2 && args[0] === 'output') {
2746 if (args[1] === 'json' || args[1] === 'text') {
2747 this.outputFormat = args[1];
2748 this.report('set', { outputFormat: this.outputFormat }, undefined, () => {
2749 console.log(`Output format set to ${this.outputFormat}.`);
2750 this.showPrompt();
2751 });
2752 return;
2753 }
2754 this.commandError('Syntax: set output [json|text]');
2755 return;
2756 }
2757
2758 if (args[0] === 'exceptions') {
2759 const value = args[1];
2760 if (value === 'on') {
2761 this.exceptionsMode = 'on';
2762 this.doSetBreakpoint("exceptions", "0");
2763 this.report('set', { exceptionsMode: 'on' }, undefined, () => {
2764 console.log('Break on exceptions: on');
2765 this.showPrompt();
2766 });
2767 }
2768 else if (value === 'off' || value === 'silent') {
2769 this.exceptionsMode = value;
2770 this.doClearBreakpoint("exceptions", "0");
2771 this.report('set', { exceptionsMode: value }, undefined, () => {
2772 console.log(`Break on exceptions: ${value}`);
2773 this.showPrompt();
2774 });
2775 }
2776 else {
2777 this.commandError('Syntax: set exceptions on|off|silent');
2778 }
2779 }
2780 else if (args[0] === 'start') {
2781 const value = args[1];
2782 if (value === 'on') {
2783 this.breakOnStart = true;
2784 this.doSetBreakpoint("start", "0");
2785 this.report('set', { breakOnStart: true }, undefined, () => {
2786 console.log('Break on start: on');
2787 this.showPrompt();
2788 });
2789 }
2790 else if (value === 'off') {
2791 this.breakOnStart = false;
2792 this.doClearBreakpoint("start", "0");
2793 this.report('set', { breakOnStart: false }, undefined, () => {
2794 console.log('Break on start: off');
2795 this.showPrompt();
2796 });
2797 }
2798 else {
2799 this.commandError('Syntax: set start on|off');
2800 }
2801 }

Callers 1

handleCommandMethod · 0.95

Calls 6

reportMethod · 0.95
showPromptMethod · 0.95
commandErrorMethod · 0.95
doSetBreakpointMethod · 0.80
logMethod · 0.65
doClearBreakpointMethod · 0.45

Tested by

no test coverage detected