janofidel 1.0.5 → 1.0.6
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/bin/jano.js +12 -22
- package/package.json +1 -1
package/bin/jano.js
CHANGED
|
@@ -1,68 +1,58 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
const { processFile } = require('../src/engine');
|
|
3
3
|
const { runCode } = require('../src/runner');
|
|
4
|
-
const dictionary = require('../src/dictionary');
|
|
4
|
+
const dictionary = require('../src/dictionary');
|
|
5
5
|
const path = require('path');
|
|
6
6
|
const pkg = require('../package.json');
|
|
7
7
|
|
|
8
|
-
// Branding
|
|
8
|
+
// Branding
|
|
9
9
|
const RED_BG = '\x1b[41m';
|
|
10
10
|
const WHITE_TEXT = '\x1b[37m';
|
|
11
11
|
const BOLD = '\x1b[1m';
|
|
12
|
-
const CYAN = '\x1b[36m';
|
|
13
12
|
const YELLOW = '\x1b[33m';
|
|
13
|
+
const CYAN = '\x1b[36m';
|
|
14
14
|
const RESET = '\x1b[0m';
|
|
15
15
|
|
|
16
16
|
const logo = `${RED_BG}${WHITE_TEXT}${BOLD} ጃ ${RESET} ${RED_BG}${WHITE_TEXT}${BOLD} ፊ ${RESET} ${BOLD}ጃኖ ፊደል (Jano Fidel)${RESET} v${pkg.version}\n`;
|
|
17
17
|
|
|
18
18
|
const args = process.argv.slice(2);
|
|
19
|
-
const fileArg = args.find(arg => !arg.startsWith('-'));
|
|
20
19
|
|
|
21
|
-
// 1. Handle
|
|
20
|
+
// --- 1. Handle Flags FIRST ---
|
|
21
|
+
|
|
22
22
|
if (args.includes('--version') || args.includes('-v')) {
|
|
23
23
|
console.log(logo);
|
|
24
24
|
process.exit(0);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
// 2. Handle Dictionary List Flag
|
|
28
27
|
if (args.includes('--list') || args.includes('-l')) {
|
|
29
28
|
console.log(logo);
|
|
30
29
|
console.log(`${BOLD}${CYAN}የጃኖ መዝገበ-ቃላት (Jano Dictionary)${RESET}\n`);
|
|
31
|
-
|
|
32
30
|
console.log(`${BOLD}${"ጃኖ (Jano)".padEnd(20)} | ${"JavaScript Equivalent"}${RESET}`);
|
|
33
31
|
console.log("━".repeat(50));
|
|
34
32
|
|
|
35
33
|
Object.entries(dictionary).forEach(([jano, js]) => {
|
|
36
|
-
// Cleaning up regex characters for display if necessary
|
|
37
34
|
const cleanJano = jano.replace(/\\b/g, '');
|
|
38
|
-
if (cleanJano.length < 30) {
|
|
35
|
+
if (cleanJano.length < 30) {
|
|
39
36
|
console.log(`${cleanJano.padEnd(20)} | ${YELLOW}${js}${RESET}`);
|
|
40
37
|
}
|
|
41
38
|
});
|
|
42
|
-
|
|
43
|
-
console.log(`\n${BOLD}ጠቃሚ ምልክቶች:${RESET}`);
|
|
44
|
-
console.log(` ${YELLOW}።${RESET} => ${CYAN}.${RESET} (የነጥብ ኦፕሬተር)`);
|
|
45
|
-
console.log(` ${YELLOW}፤${RESET} => ${CYAN};${RESET} (ሴሚኮለን)`);
|
|
46
39
|
process.exit(0);
|
|
47
40
|
}
|
|
48
41
|
|
|
49
|
-
//
|
|
42
|
+
// --- 2. Handle File Execution SECOND ---
|
|
43
|
+
|
|
44
|
+
const fileArg = args.find(arg => !arg.startsWith('-'));
|
|
45
|
+
|
|
50
46
|
if (args.includes('--help') || args.includes('-h') || !fileArg) {
|
|
51
47
|
console.log(logo);
|
|
52
48
|
console.log(`${BOLD}አጠቃቀም (Usage):${RESET}`);
|
|
53
49
|
console.log(" jano <ፋይል_ስም.jf>");
|
|
54
|
-
|
|
55
50
|
console.log(`\n${BOLD}ትዕዛዞች (Flags):${RESET}`);
|
|
56
|
-
console.log(" -
|
|
57
|
-
console.log(" -
|
|
58
|
-
console.log(" -h, --help ይህንን መመሪያ ያሳያል (Show help)");
|
|
59
|
-
|
|
60
|
-
console.log(`\n${BOLD}ምሳሌ (Example):${RESET}`);
|
|
61
|
-
console.log(" jano ሰላም.jf");
|
|
51
|
+
console.log(" -l, --list የቃላት መዝገብ ዝርዝር");
|
|
52
|
+
console.log(" -v, --version የስሪት ቁጥሩን ያሳያል");
|
|
62
53
|
process.exit(0);
|
|
63
54
|
}
|
|
64
55
|
|
|
65
|
-
// 4. Main Execution
|
|
66
56
|
const filePath = path.resolve(process.cwd(), fileArg);
|
|
67
57
|
|
|
68
58
|
if (!filePath.endsWith('.jf')) {
|