janofidel 1.0.4 → 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.
Files changed (3) hide show
  1. package/README.md +14 -0
  2. package/bin/jano.js +30 -4
  3. 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,19 +1,22 @@
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'); // Import the mapping
4
5
  const path = require('path');
5
6
  const pkg = require('../package.json');
6
7
 
7
- // Branding Colors
8
+ // Branding & Styling
8
9
  const RED_BG = '\x1b[41m';
9
10
  const WHITE_TEXT = '\x1b[37m';
10
11
  const BOLD = '\x1b[1m';
12
+ const CYAN = '\x1b[36m';
13
+ const YELLOW = '\x1b[33m';
11
14
  const RESET = '\x1b[0m';
12
15
 
13
16
  const logo = `${RED_BG}${WHITE_TEXT}${BOLD} ጃ ${RESET} ${RED_BG}${WHITE_TEXT}${BOLD} ፊ ${RESET} ${BOLD}ጃኖ ፊደል (Jano Fidel)${RESET} v${pkg.version}\n`;
14
17
 
15
18
  const args = process.argv.slice(2);
16
- const fileArg = args[0];
19
+ const fileArg = args.find(arg => !arg.startsWith('-'));
17
20
 
18
21
  // 1. Handle Version Flag
19
22
  if (args.includes('--version') || args.includes('-v')) {
@@ -21,7 +24,29 @@ if (args.includes('--version') || args.includes('-v')) {
21
24
  process.exit(0);
22
25
  }
23
26
 
24
- // 2. Handle Help Flag or No Arguments
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);
47
+ }
48
+
49
+ // 3. Handle Help Flag or No Arguments
25
50
  if (args.includes('--help') || args.includes('-h') || !fileArg) {
26
51
  console.log(logo);
27
52
  console.log(`${BOLD}አጠቃቀም (Usage):${RESET}`);
@@ -29,6 +54,7 @@ if (args.includes('--help') || args.includes('-h') || !fileArg) {
29
54
 
30
55
  console.log(`\n${BOLD}ትዕዛዞች (Flags):${RESET}`);
31
56
  console.log(" -v, --version የስሪት ቁጥሩን ያሳያል (Show version)");
57
+ console.log(" -l, --list የቃላት መዝገብ ዝርዝር (List keywords)");
32
58
  console.log(" -h, --help ይህንን መመሪያ ያሳያል (Show help)");
33
59
 
34
60
  console.log(`\n${BOLD}ምሳሌ (Example):${RESET}`);
@@ -36,7 +62,7 @@ if (args.includes('--help') || args.includes('-h') || !fileArg) {
36
62
  process.exit(0);
37
63
  }
38
64
 
39
- // 3. Main Execution
65
+ // 4. Main Execution
40
66
  const filePath = path.resolve(process.cwd(), fileArg);
41
67
 
42
68
  if (!filePath.endsWith('.jf')) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "janofidel",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "Amharic Programming Language (Jano Fidel)",
5
5
  "main": "src/engine.js",
6
6
  "bin": {