starlight-cli 1.0.6 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2444,6 +2444,8 @@ const Lexer = __nccwpck_require__(211);
2444
2444
  const Parser = __nccwpck_require__(222);
2445
2445
  const Evaluator = __nccwpck_require__(112);
2446
2446
 
2447
+ const VERSION = '1.0.7';
2448
+
2447
2449
  const COLOR = {
2448
2450
  reset: '\x1b[0m',
2449
2451
  bold: '\x1b[1m',
@@ -2482,10 +2484,36 @@ function printSourceContext(code, line, column) {
2482
2484
  );
2483
2485
  }
2484
2486
 
2487
+
2485
2488
  const args = process.argv.slice(2);
2486
2489
 
2487
2490
  if (args.length === 0) {
2488
- return fatal('Usage: starlight <file.sl>');
2491
+ console.log(`
2492
+ Starlight Programming Language
2493
+
2494
+ Usage:
2495
+ starlight <file.sl> Run a Starlight program
2496
+ starlight -v Show version
2497
+ starlight --help Show help
2498
+ `);
2499
+ process.exit(0);
2500
+ }
2501
+
2502
+ if (args[0] === '-v' || args[0] === '--version') {
2503
+ console.log(`Starlight CLI v${VERSION}`);
2504
+ process.exit(0);
2505
+ }
2506
+
2507
+ if (args[0] === '--help') {
2508
+ console.log(`
2509
+ Starlight CLI Help
2510
+
2511
+ Commands:
2512
+ starlight file.sl Run a Starlight program
2513
+ starlight -v Show version
2514
+ starlight --help Show this help message
2515
+ `);
2516
+ process.exit(0);
2489
2517
  }
2490
2518
 
2491
2519
  const filePath = path.resolve(args[0]);
@@ -2501,6 +2529,7 @@ try {
2501
2529
  return fatal(`Failed to read file: ${err.message}`);
2502
2530
  }
2503
2531
 
2532
+
2504
2533
  let tokens;
2505
2534
  try {
2506
2535
  const lexer = new Lexer(code);
@@ -2553,6 +2582,7 @@ console.log(
2553
2582
  '\nProgram finished successfully.' +
2554
2583
  COLOR.reset
2555
2584
  );
2585
+
2556
2586
  waitAndExit(0);
2557
2587
 
2558
2588
  module.exports = __webpack_exports__;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "starlight-cli",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "Starlight Programming Language CLI",
5
5
  "bin": {
6
6
  "starlight": "index.js"
package/src/starlight.js CHANGED
@@ -5,6 +5,8 @@ const Lexer = require('./lexer');
5
5
  const Parser = require('./parser');
6
6
  const Evaluator = require('./evaluator');
7
7
 
8
+ const VERSION = '1.0.7';
9
+
8
10
  const COLOR = {
9
11
  reset: '\x1b[0m',
10
12
  bold: '\x1b[1m',
@@ -43,10 +45,36 @@ function printSourceContext(code, line, column) {
43
45
  );
44
46
  }
45
47
 
48
+
46
49
  const args = process.argv.slice(2);
47
50
 
48
51
  if (args.length === 0) {
49
- return fatal('Usage: starlight <file.sl>');
52
+ console.log(`
53
+ Starlight Programming Language
54
+
55
+ Usage:
56
+ starlight <file.sl> Run a Starlight program
57
+ starlight -v Show version
58
+ starlight --help Show help
59
+ `);
60
+ process.exit(0);
61
+ }
62
+
63
+ if (args[0] === '-v' || args[0] === '--version') {
64
+ console.log(`Starlight CLI v${VERSION}`);
65
+ process.exit(0);
66
+ }
67
+
68
+ if (args[0] === '--help') {
69
+ console.log(`
70
+ Starlight CLI Help
71
+
72
+ Commands:
73
+ starlight file.sl Run a Starlight program
74
+ starlight -v Show version
75
+ starlight --help Show this help message
76
+ `);
77
+ process.exit(0);
50
78
  }
51
79
 
52
80
  const filePath = path.resolve(args[0]);
@@ -62,6 +90,7 @@ try {
62
90
  return fatal(`Failed to read file: ${err.message}`);
63
91
  }
64
92
 
93
+
65
94
  let tokens;
66
95
  try {
67
96
  const lexer = new Lexer(code);
@@ -114,4 +143,5 @@ console.log(
114
143
  '\nProgram finished successfully.' +
115
144
  COLOR.reset
116
145
  );
146
+
117
147
  waitAndExit(0);