janofidel 1.0.1 → 1.0.4

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.
Files changed (2) hide show
  1. package/bin/jano.js +27 -17
  2. package/package.json +1 -1
package/bin/jano.js CHANGED
@@ -1,42 +1,52 @@
1
1
  #!/usr/bin/env node
2
- const { processFile } = require('../src/engine'); // Assuming processFile handles reading + prelude
2
+ const { processFile } = require('../src/engine');
3
3
  const { runCode } = require('../src/runner');
4
4
  const path = require('path');
5
+ const pkg = require('../package.json');
5
6
 
6
- // Branding
7
+ // Branding Colors
7
8
  const RED_BG = '\x1b[41m';
8
9
  const WHITE_TEXT = '\x1b[37m';
9
10
  const BOLD = '\x1b[1m';
10
11
  const RESET = '\x1b[0m';
11
12
 
12
- const logo = `${RED_BG}${WHITE_TEXT}${BOLD} ጃ ${RESET} ${RED_BG}${WHITE_TEXT}${BOLD} ፊ ${RESET} ${BOLD}ጃኖ ፊደል (Jano Fidel)${RESET}\n`;
13
+ const logo = `${RED_BG}${WHITE_TEXT}${BOLD} ጃ ${RESET} ${RED_BG}${WHITE_TEXT}${BOLD} ፊ ${RESET} ${BOLD}ጃኖ ፊደል (Jano Fidel)${RESET} v${pkg.version}\n`;
13
14
 
14
- const fileArg = process.argv[2];
15
+ const args = process.argv.slice(2);
16
+ const fileArg = args[0];
15
17
 
16
- // 1. Show Help/Logo if no file provided
17
- if (!fileArg) {
18
+ // 1. Handle Version Flag
19
+ if (args.includes('--version') || args.includes('-v')) {
18
20
  console.log(logo);
19
- console.log("አጠቃቀም: jano <ፋይል_ስም.jf>");
20
- process.exit(1);
21
+ process.exit(0);
22
+ }
23
+
24
+ // 2. Handle Help Flag or No Arguments
25
+ if (args.includes('--help') || args.includes('-h') || !fileArg) {
26
+ console.log(logo);
27
+ console.log(`${BOLD}አጠቃቀም (Usage):${RESET}`);
28
+ console.log(" jano <ፋይል_ስም.jf>");
29
+
30
+ console.log(`\n${BOLD}ትዕዛዞች (Flags):${RESET}`);
31
+ console.log(" -v, --version የስሪት ቁጥሩን ያሳያል (Show version)");
32
+ console.log(" -h, --help ይህንን መመሪያ ያሳያል (Show help)");
33
+
34
+ console.log(`\n${BOLD}ምሳሌ (Example):${RESET}`);
35
+ console.log(" jano ሰላም.jf");
36
+ process.exit(0);
21
37
  }
22
38
 
23
- // 2. Resolve paths
39
+ // 3. Main Execution
24
40
  const filePath = path.resolve(process.cwd(), fileArg);
25
41
 
26
42
  if (!filePath.endsWith('.jf')) {
27
- console.error("ስህተት: ፋይሉ በ '.jf' ማለቅ አለበት።");
43
+ console.error(`${BOLD}${RED_BG} ስህተት ${RESET} ፋይሉ በ '.jf' ማለቅ አለበት።`);
28
44
  process.exit(1);
29
45
  }
30
46
 
31
- // 3. The Execution Flow
32
47
  try {
33
- // Note: Use your existing processFile which reads the code and adds the prelude
34
48
  const jsCode = processFile(filePath);
35
-
36
- // This calls your professional runner with the styled boxes
37
49
  runCode(jsCode, filePath);
38
-
39
50
  } catch (err) {
40
- // This catches high-level file reading errors
41
- console.error(`\n[የጃኖ ስህተት]: ${err.message}`);
51
+ console.error(`\n${BOLD}${RED_BG} የጃኖ ስህተት ${RESET}: ${err.message}`);
42
52
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "janofidel",
3
- "version": "1.0.1",
3
+ "version": "1.0.4",
4
4
  "description": "Amharic Programming Language (Jano Fidel)",
5
5
  "main": "src/engine.js",
6
6
  "bin": {