janofidel 1.0.1 → 1.0.5
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/README.md +14 -0
- package/bin/jano.js +53 -17
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -21,6 +21,12 @@
|
|
|
21
21
|
|
|
22
22
|
### 1. Installation
|
|
23
23
|
|
|
24
|
+
## For users
|
|
25
|
+
```bash
|
|
26
|
+
npm install -g janofidel@latest
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## For developers
|
|
24
30
|
Clone the repository and link it to your global path:
|
|
25
31
|
|
|
26
32
|
```bash
|
|
@@ -52,6 +58,14 @@ jano ሰላምታ.jf
|
|
|
52
58
|
|
|
53
59
|
```
|
|
54
60
|
|
|
61
|
+
---
|
|
62
|
+
## 🛠️ CLI ትዕዛዞች (CLI Usage)
|
|
63
|
+
|command(ትዕዛዝ) | Description(መግለጫ) |
|
|
64
|
+
| --- | --- |
|
|
65
|
+
|`jano <file.jf>` | Runs the JanoFidel file |
|
|
66
|
+
|`jano -v, --version` | Show current version |
|
|
67
|
+
|`jano -h, --help` | Show the help manual |
|
|
68
|
+
|
|
55
69
|
---
|
|
56
70
|
|
|
57
71
|
## 📚 የቋንቋው መዝገበ-ቃላት (Dictionary Mapping)
|
package/bin/jano.js
CHANGED
|
@@ -1,42 +1,78 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const { processFile } = require('../src/engine');
|
|
2
|
+
const { processFile } = require('../src/engine');
|
|
3
3
|
const { runCode } = require('../src/runner');
|
|
4
|
+
const dictionary = require('../src/dictionary'); // Import the mapping
|
|
4
5
|
const path = require('path');
|
|
6
|
+
const pkg = require('../package.json');
|
|
5
7
|
|
|
6
|
-
// Branding
|
|
8
|
+
// Branding & Styling
|
|
7
9
|
const RED_BG = '\x1b[41m';
|
|
8
10
|
const WHITE_TEXT = '\x1b[37m';
|
|
9
11
|
const BOLD = '\x1b[1m';
|
|
12
|
+
const CYAN = '\x1b[36m';
|
|
13
|
+
const YELLOW = '\x1b[33m';
|
|
10
14
|
const RESET = '\x1b[0m';
|
|
11
15
|
|
|
12
|
-
const logo = `${RED_BG}${WHITE_TEXT}${BOLD} ጃ ${RESET} ${RED_BG}${WHITE_TEXT}${BOLD} ፊ ${RESET} ${BOLD}ጃኖ ፊደል (Jano Fidel)${RESET}\n`;
|
|
16
|
+
const logo = `${RED_BG}${WHITE_TEXT}${BOLD} ጃ ${RESET} ${RED_BG}${WHITE_TEXT}${BOLD} ፊ ${RESET} ${BOLD}ጃኖ ፊደል (Jano Fidel)${RESET} v${pkg.version}\n`;
|
|
13
17
|
|
|
14
|
-
const
|
|
18
|
+
const args = process.argv.slice(2);
|
|
19
|
+
const fileArg = args.find(arg => !arg.startsWith('-'));
|
|
15
20
|
|
|
16
|
-
// 1.
|
|
17
|
-
if (
|
|
21
|
+
// 1. Handle Version Flag
|
|
22
|
+
if (args.includes('--version') || args.includes('-v')) {
|
|
18
23
|
console.log(logo);
|
|
19
|
-
|
|
20
|
-
|
|
24
|
+
process.exit(0);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// 2. Handle Dictionary List Flag
|
|
28
|
+
if (args.includes('--list') || args.includes('-l')) {
|
|
29
|
+
console.log(logo);
|
|
30
|
+
console.log(`${BOLD}${CYAN}የጃኖ መዝገበ-ቃላት (Jano Dictionary)${RESET}\n`);
|
|
31
|
+
|
|
32
|
+
console.log(`${BOLD}${"ጃኖ (Jano)".padEnd(20)} | ${"JavaScript Equivalent"}${RESET}`);
|
|
33
|
+
console.log("━".repeat(50));
|
|
34
|
+
|
|
35
|
+
Object.entries(dictionary).forEach(([jano, js]) => {
|
|
36
|
+
// Cleaning up regex characters for display if necessary
|
|
37
|
+
const cleanJano = jano.replace(/\\b/g, '');
|
|
38
|
+
if (cleanJano.length < 30) { // Filter out complex regex patterns
|
|
39
|
+
console.log(`${cleanJano.padEnd(20)} | ${YELLOW}${js}${RESET}`);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
console.log(`\n${BOLD}ጠቃሚ ምልክቶች:${RESET}`);
|
|
44
|
+
console.log(` ${YELLOW}።${RESET} => ${CYAN}.${RESET} (የነጥብ ኦፕሬተር)`);
|
|
45
|
+
console.log(` ${YELLOW}፤${RESET} => ${CYAN};${RESET} (ሴሚኮለን)`);
|
|
46
|
+
process.exit(0);
|
|
21
47
|
}
|
|
22
48
|
|
|
23
|
-
//
|
|
49
|
+
// 3. Handle Help Flag or No Arguments
|
|
50
|
+
if (args.includes('--help') || args.includes('-h') || !fileArg) {
|
|
51
|
+
console.log(logo);
|
|
52
|
+
console.log(`${BOLD}አጠቃቀም (Usage):${RESET}`);
|
|
53
|
+
console.log(" jano <ፋይል_ስም.jf>");
|
|
54
|
+
|
|
55
|
+
console.log(`\n${BOLD}ትዕዛዞች (Flags):${RESET}`);
|
|
56
|
+
console.log(" -v, --version የስሪት ቁጥሩን ያሳያል (Show version)");
|
|
57
|
+
console.log(" -l, --list የቃላት መዝገብ ዝርዝር (List keywords)");
|
|
58
|
+
console.log(" -h, --help ይህንን መመሪያ ያሳያል (Show help)");
|
|
59
|
+
|
|
60
|
+
console.log(`\n${BOLD}ምሳሌ (Example):${RESET}`);
|
|
61
|
+
console.log(" jano ሰላም.jf");
|
|
62
|
+
process.exit(0);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// 4. Main Execution
|
|
24
66
|
const filePath = path.resolve(process.cwd(), fileArg);
|
|
25
67
|
|
|
26
68
|
if (!filePath.endsWith('.jf')) {
|
|
27
|
-
console.error(
|
|
69
|
+
console.error(`${BOLD}${RED_BG} ስህተት ${RESET} ፋይሉ በ '.jf' ማለቅ አለበት።`);
|
|
28
70
|
process.exit(1);
|
|
29
71
|
}
|
|
30
72
|
|
|
31
|
-
// 3. The Execution Flow
|
|
32
73
|
try {
|
|
33
|
-
// Note: Use your existing processFile which reads the code and adds the prelude
|
|
34
74
|
const jsCode = processFile(filePath);
|
|
35
|
-
|
|
36
|
-
// This calls your professional runner with the styled boxes
|
|
37
75
|
runCode(jsCode, filePath);
|
|
38
|
-
|
|
39
76
|
} catch (err) {
|
|
40
|
-
|
|
41
|
-
console.error(`\n[የጃኖ ስህተት]: ${err.message}`);
|
|
77
|
+
console.error(`\n${BOLD}${RED_BG} የጃኖ ስህተት ${RESET}: ${err.message}`);
|
|
42
78
|
}
|