@typinghare/trick 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 (3) hide show
  1. package/dist/app.js +16 -2
  2. package/package.json +1 -2
  3. package/src/app.ts +18 -2
package/dist/app.js CHANGED
@@ -6,7 +6,7 @@ import { TRICK_ENCRYPTED_DIR } from './constant.js';
6
6
  import fsExtra from 'fs-extra';
7
7
  import chalk from 'chalk';
8
8
  const program = new Command();
9
- program.version('Trick v1.0.0 \nby James Chen (jameschan312.cn@gmail.com)');
9
+ program.version('Trick v1.0.3 \nby James Chen (jameschan312.cn@gmail.com)');
10
10
  program.description('Save credential files to remote safely.');
11
11
  program
12
12
  .command('add')
@@ -77,7 +77,7 @@ program
77
77
  .action(async (secretName) => {
78
78
  await updateConfig((config) => {
79
79
  config.default_secret_name = secretName;
80
- return false;
80
+ return true;
81
81
  });
82
82
  });
83
83
  program
@@ -89,6 +89,20 @@ program
89
89
  return false;
90
90
  });
91
91
  });
92
+ program
93
+ .command('list')
94
+ .description('Display a list of targets.')
95
+ .action(async () => {
96
+ await updateConfig((config) => {
97
+ for (const target of config.targets) {
98
+ console.log(chalk.cyan(target.secret_name));
99
+ for (const file of target.files) {
100
+ console.log(' ' + chalk.yellow(file));
101
+ }
102
+ }
103
+ return false;
104
+ });
105
+ });
92
106
  program.parse();
93
107
  process.on('uncaughtException', (err) => {
94
108
  resolve_error(err);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@typinghare/trick",
3
3
  "description": "Save credential files to remote safely.",
4
- "version": "1.0.2",
4
+ "version": "1.0.3",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "type": "module",
@@ -24,7 +24,6 @@
24
24
  "@types/fs-extra": "^11.0.4",
25
25
  "prettier": "^3.3.3"
26
26
  },
27
- "packageManager": "pnpm@8.15.1+sha1.8adba2d20330c02d3856e18c4eb3819d1d3ca6aa",
28
27
  "scripts": {
29
28
  "build": "tsc"
30
29
  }
package/src/app.ts CHANGED
@@ -20,7 +20,7 @@ import chalk from 'chalk'
20
20
 
21
21
  const program = new Command()
22
22
 
23
- program.version('Trick v1.0.0 \nby James Chen (jameschan312.cn@gmail.com)')
23
+ program.version('Trick v1.0.3 \nby James Chen (jameschan312.cn@gmail.com)')
24
24
  program.description('Save credential files to remote safely.')
25
25
 
26
26
  program
@@ -124,7 +124,7 @@ program
124
124
  await updateConfig((config) => {
125
125
  config.default_secret_name = secretName
126
126
 
127
- return false
127
+ return true
128
128
  })
129
129
  })
130
130
 
@@ -138,6 +138,22 @@ program
138
138
  })
139
139
  })
140
140
 
141
+ program
142
+ .command('list')
143
+ .description('Display a list of targets.')
144
+ .action(async (): Promise<void> => {
145
+ await updateConfig((config) => {
146
+ for (const target of config.targets) {
147
+ console.log(chalk.cyan(target.secret_name))
148
+ for (const file of target.files) {
149
+ console.log(' ' + chalk.yellow(file))
150
+ }
151
+ }
152
+
153
+ return false
154
+ })
155
+ })
156
+
141
157
  program.parse()
142
158
 
143
159
  process.on('uncaughtException', (err) => {