yuangs 1.0.2 → 1.0.3

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 (4) hide show
  1. package/README.md +19 -4
  2. package/cli.js +40 -14
  3. package/index.js +0 -1
  4. package/package.json +7 -3
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # yuangs CLI
2
2
 
3
- 苑广山的个人命令行工具。
3
+ 🎨 YGS 的个人命令行工具(彩色版)
4
4
 
5
5
  ## 安装
6
6
 
@@ -13,8 +13,23 @@ npm install -g yuangs
13
13
  ## 使用命令
14
14
 
15
15
  ```bash
16
- yuangs shici # 打开古诗词
17
- yuangs dict # 打开词典
18
- yuangs pong # 打开游戏
16
+ yuangs shici # 打开古诗词 PWA
17
+ yuangs dict # 打开英语词典
18
+ yuangs pong # 打开 Pong 游戏
19
19
  yuangs list # 列出所有链接
20
+ yuangs help # 显示帮助
20
21
  ```
22
+
23
+ ## 新特性 (v1.0.3)
24
+
25
+ ✨ 彩色终端输出,更美观易读!
26
+
27
+ ## 应用列表
28
+
29
+ - **古诗词 PWA**: https://wealth.want.biz/shici/index.html
30
+ - **英语词典**: https://wealth.want.biz/pages/dict.html
31
+ - **Pong 游戏**: https://wealth.want.biz/pages/pong.html
32
+
33
+ ## 维护者
34
+
35
+ yuanguangshan
package/cli.js CHANGED
@@ -1,26 +1,52 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  const yuangs = require('./index.js');
4
+ const chalk = require('chalk');
4
5
  const args = process.argv.slice(2);
5
6
  const command = args[0];
6
7
 
7
8
  function printHelp() {
8
- console.log(`
9
- Usage: yuangs <command>
9
+ console.log(chalk.bold.cyan('\n🎨 YGS Apps - 个人应用启动器\n'));
10
+ console.log(chalk.white('使用方法:') + chalk.gray(' yuangs <命令>\n'));
11
+ console.log(chalk.bold('命令列表:'));
12
+ console.log(` ${chalk.green('shici')} 打开古诗词 PWA`);
13
+ console.log(` ${chalk.green('dict')} 打开英语词典`);
14
+ console.log(` ${chalk.green('pong')} 打开 Pong 游戏`);
15
+ console.log(` ${chalk.green('list')} 列出所有应用链接`);
16
+ console.log(` ${chalk.green('help')} 显示帮助信息\n`);
17
+ console.log(chalk.gray('示例: yuangs shici\n'));
18
+ }
10
19
 
11
- Commands:
12
- shici 打开古诗词 PWA
13
- dict 打开英语词典
14
- pong 打开 Pong 游戏
15
- list 列出所有应用链接
16
- help 显示帮助信息
17
- `);
20
+ function printSuccess(app, url) {
21
+ console.log(chalk.green(`✓ 正在打开 ${app}...`));
22
+ console.log(chalk.gray(` ${url}`));
18
23
  }
19
24
 
20
25
  switch (command) {
21
- case 'shici': yuangs.openShici(); break;
22
- case 'dict': yuangs.openDict(); break;
23
- case 'pong': yuangs.openPong(); break;
24
- case 'list': yuangs.listApps(); break;
25
- default: printHelp(); break;
26
+ case 'shici':
27
+ printSuccess('古诗词应用', yuangs.urls.shici);
28
+ yuangs.openShici();
29
+ break;
30
+ case 'dict':
31
+ printSuccess('英语词典', yuangs.urls.dict);
32
+ yuangs.openDict();
33
+ break;
34
+ case 'pong':
35
+ printSuccess('Pong 游戏', yuangs.urls.pong);
36
+ yuangs.openPong();
37
+ break;
38
+ case 'list':
39
+ console.log(chalk.bold.cyan('\n📱 YGS Apps 列表\n'));
40
+ console.log(chalk.gray('─────────────────────────────────────────────────'));
41
+ Object.entries(yuangs.urls).forEach(([key, url]) => {
42
+ console.log(` ${chalk.green('●')} ${chalk.bold(key.padEnd(8))} ${chalk.blue(url)}`);
43
+ });
44
+ console.log(chalk.gray('─────────────────────────────────────────────────\n'));
45
+ break;
46
+ case 'help':
47
+ case '--help':
48
+ case '-h':
49
+ default:
50
+ printHelp();
51
+ break;
26
52
  }
package/index.js CHANGED
@@ -13,7 +13,6 @@ function openUrl(url) {
13
13
  case 'win32': command = `start "${url}"`; break;
14
14
  default: command = `xdg-open "${url}"`; break;
15
15
  }
16
- console.log(`正在打开: ${url} ...`);
17
16
  exec(command);
18
17
  }
19
18
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "yuangs",
3
- "version": "1.0.2",
4
- "description": "苑广山的个人应用集合 CLI",
3
+ "version": "1.0.3",
4
+ "description": "苑广山的个人应用集合 CLI(彩色版)",
5
5
  "main": "index.js",
6
6
  "bin": {
7
7
  "yuangs": "./cli.js"
@@ -12,10 +12,14 @@
12
12
  "keywords": [
13
13
  "yuangs",
14
14
  "cli",
15
- "tools"
15
+ "tools",
16
+ "colorful"
16
17
  ],
17
18
  "author": "yuanguangshan",
18
19
  "license": "ISC",
20
+ "dependencies": {
21
+ "chalk": "^4.1.2"
22
+ },
19
23
  "publishConfig": {
20
24
  "access": "public"
21
25
  }