MCPcopy Index your code
hub / github.com/prettydiff/prettydiff / modeval

Function modeval

services.ts:611–661  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

609 },
610 // determines if mode option is specified, and so it will become the command in the absense of an accepted command
611 modeval = function node_command_modeval():boolean {
612 let a:number = 0,
613 diff:boolean = false,
614 source:boolean = false;
615 const len:number = process.argv.length;
616 if (len > 0) {
617 do {
618 if (process.argv[a].indexOf("mode") === 0) {
619 if (process.argv[a].indexOf("beautify") > 0) {
620 mode = "beautify";
621 } else if (process.argv[a].indexOf("diff") > 0) {
622 mode = "diff";
623 } else if (process.argv[a].indexOf("minify") > 0) {
624 mode = "minify";
625 } else if (process.argv[a].indexOf("parse") > 0) {
626 mode = "parse";
627 } else {
628 return false;
629 }
630 console.log("");
631 console.log(`${boldarg} is not a supported command. Pretty Diff is assuming command ${text.bold + text.cyan + mode + text.none}.`);
632 console.log("");
633 return true;
634 }
635 if (process.argv[a].replace(/\s+/g, "").indexOf("source:") === 0 || process.argv[a].replace(/\s+/g, "").indexOf("source=") === 0 || process.argv[a].replace(/\s+/g, "").indexOf("source\"") === 0 || process.argv[a].replace(/\s+/g, "").indexOf("source'") === 0) {
636 source = true;
637 } else if (process.argv[a].replace(/\s+/g, "").indexOf("diff:") === 0 || process.argv[a].replace(/\s+/g, "").indexOf("diff=") === 0 || process.argv[a].replace(/\s+/g, "").indexOf("diff\"") === 0 || process.argv[a].replace(/\s+/g, "").indexOf("diff'") === 0) {
638 diff = true;
639 }
640 a = a + 1;
641 } while (a < len);
642 if (source === true || arg.replace(/\s+/g, "").indexOf("source:") === 0 || arg.replace(/\s+/g, "").indexOf("source=") === 0 || arg.replace(/\s+/g, "").indexOf("source\"") === 0 || arg.replace(/\s+/g, "").indexOf("source'") === 0) {
643 if (source === false) {
644 process.argv.push(arg);
645 }
646 if (diff === true || arg.replace(/\s+/g, "").indexOf("diff:") === 0 || arg.replace(/\s+/g, "").indexOf("diff=") === 0 || arg.replace(/\s+/g, "").indexOf("diff\"") === 0 || arg.replace(/\s+/g, "").indexOf("diff'") === 0) {
647 if (diff === false) {
648 process.argv.push(arg);
649 }
650 mode = "diff";
651 } else {
652 mode = "beautify";
653 }
654 console.log("");
655 console.log(`No supported command found. Pretty Diff is assuming command ${text.bold + text.cyan + mode + text.none}.`);
656 console.log("");
657 return true;
658 }
659 }
660 return false;
661 };
662
663 if (process.argv[2] === "prettydiff_debug") {
664 process.argv = process.argv.slice(3);

Callers 1

services.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected