@initx-plugin/cp 0.0.17 → 0.0.18
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 +6 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.mjs +17 -1
- package/package.json +5 -5
package/README.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -2,6 +2,7 @@ import { InitxPlugin, InitxContext } from '@initx-plugin/core';
|
|
|
2
2
|
|
|
3
3
|
declare enum CpType {
|
|
4
4
|
SSH = "ssh",
|
|
5
|
+
GPG = "gpg",
|
|
5
6
|
CWD = "cwd"
|
|
6
7
|
}
|
|
7
8
|
|
|
@@ -12,6 +13,7 @@ declare class CpPlugin extends InitxPlugin {
|
|
|
12
13
|
}[];
|
|
13
14
|
handle(_ctx: InitxContext, cpType: CpType, ...others: string[]): Promise<void>;
|
|
14
15
|
[CpType.SSH](): Promise<void>;
|
|
16
|
+
[CpType.GPG](): Promise<void>;
|
|
15
17
|
[CpType.CWD](): Promise<void>;
|
|
16
18
|
private copy;
|
|
17
19
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { InitxPlugin, InitxContext } from '@initx-plugin/core';
|
|
|
2
2
|
|
|
3
3
|
declare enum CpType {
|
|
4
4
|
SSH = "ssh",
|
|
5
|
+
GPG = "gpg",
|
|
5
6
|
CWD = "cwd"
|
|
6
7
|
}
|
|
7
8
|
|
|
@@ -12,6 +13,7 @@ declare class CpPlugin extends InitxPlugin {
|
|
|
12
13
|
}[];
|
|
13
14
|
handle(_ctx: InitxContext, cpType: CpType, ...others: string[]): Promise<void>;
|
|
14
15
|
[CpType.SSH](): Promise<void>;
|
|
16
|
+
[CpType.GPG](): Promise<void>;
|
|
15
17
|
[CpType.CWD](): Promise<void>;
|
|
16
18
|
private copy;
|
|
17
19
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -4,10 +4,11 @@ import { existsSync, readdirSync, readFileSync } from 'node:fs';
|
|
|
4
4
|
import { resolve } from 'node:path';
|
|
5
5
|
import clipboard from 'clipboardy';
|
|
6
6
|
import { InitxPlugin } from '@initx-plugin/core';
|
|
7
|
-
import { log, inquirer } from '@initx-plugin/utils';
|
|
7
|
+
import { log, inquirer, gpgList, c } from '@initx-plugin/utils';
|
|
8
8
|
|
|
9
9
|
var CpType = /* @__PURE__ */ ((CpType2) => {
|
|
10
10
|
CpType2["SSH"] = "ssh";
|
|
11
|
+
CpType2["GPG"] = "gpg";
|
|
11
12
|
CpType2["CWD"] = "cwd";
|
|
12
13
|
return CpType2;
|
|
13
14
|
})(CpType || {});
|
|
@@ -60,6 +61,21 @@ class CpPlugin extends InitxPlugin {
|
|
|
60
61
|
this.copy(publicKey);
|
|
61
62
|
log.success("Key copied to clipboard");
|
|
62
63
|
}
|
|
64
|
+
async [CpType.GPG]() {
|
|
65
|
+
const list = await gpgList();
|
|
66
|
+
if (list.length === 0) {
|
|
67
|
+
log.error("No GPG keys found");
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
let index = 0;
|
|
71
|
+
if (list.length > 1) {
|
|
72
|
+
index = await inquirer.select("Select GPG key", list.map(({ key: key2, name, email }) => `${key2} - ${name} <${email}>`));
|
|
73
|
+
}
|
|
74
|
+
const { key } = list[index];
|
|
75
|
+
const result = await c("gpg", ["--armor", "--export", key]);
|
|
76
|
+
this.copy(result.content);
|
|
77
|
+
log.success("GPG public key copied to clipboard");
|
|
78
|
+
}
|
|
63
79
|
async [CpType.CWD]() {
|
|
64
80
|
this.copy(cwd());
|
|
65
81
|
log.success("Current working directory copied to clipboard");
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@initx-plugin/cp",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.18",
|
|
5
5
|
"description": "initx plugin, copy some text to clipboard",
|
|
6
6
|
"author": "imba97",
|
|
7
7
|
"license": "MIT",
|
|
@@ -24,20 +24,20 @@
|
|
|
24
24
|
"dist"
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@initx-plugin/core": "^0.0.
|
|
28
|
-
"@initx-plugin/utils": "^0.0.
|
|
27
|
+
"@initx-plugin/core": "^0.0.23",
|
|
28
|
+
"@initx-plugin/utils": "^0.0.23",
|
|
29
29
|
"clipboardy": "^4.0.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@imba97/eslint-config": "^0.0.4",
|
|
33
33
|
"@types/node": "^22.9.0",
|
|
34
34
|
"bumpp": "^9.8.1",
|
|
35
|
-
"eslint": "^9.
|
|
35
|
+
"eslint": "^9.15.0",
|
|
36
36
|
"lint-staged": "^15.2.10",
|
|
37
37
|
"simple-git-hooks": "^2.11.1",
|
|
38
38
|
"typescript": "5.5.4",
|
|
39
39
|
"unbuild": "^2.0.0",
|
|
40
|
-
"vitest": "^2.1.
|
|
40
|
+
"vitest": "^2.1.5"
|
|
41
41
|
},
|
|
42
42
|
"simple-git-hooks": {
|
|
43
43
|
"pre-commit": "pnpm lint-staged"
|