@initx-plugin/cp 0.0.20 → 0.0.22
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/dist/index.d.mts +3 -6
- package/dist/index.d.ts +3 -6
- package/dist/index.mjs +1 -1
- package/package.json +14 -14
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InitxPlugin, InitxContext } from '@initx-plugin/core';
|
|
1
|
+
import { InitxPlugin, InitxMatcherRules, InitxContext } from '@initx-plugin/core';
|
|
2
2
|
|
|
3
3
|
declare enum CpType {
|
|
4
4
|
SSH = "ssh",
|
|
@@ -7,11 +7,8 @@ declare enum CpType {
|
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
declare class CpPlugin extends InitxPlugin {
|
|
10
|
-
rules:
|
|
11
|
-
|
|
12
|
-
description: string;
|
|
13
|
-
}[];
|
|
14
|
-
handle(_ctx: InitxContext, cpType: CpType, ...others: string[]): Promise<void>;
|
|
10
|
+
rules: InitxMatcherRules;
|
|
11
|
+
handle(_ctx: InitxContext, cpType: CpType): Promise<void>;
|
|
15
12
|
[CpType.SSH](): Promise<void>;
|
|
16
13
|
[CpType.GPG](): Promise<void>;
|
|
17
14
|
[CpType.CWD](): Promise<void>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InitxPlugin, InitxContext } from '@initx-plugin/core';
|
|
1
|
+
import { InitxPlugin, InitxMatcherRules, InitxContext } from '@initx-plugin/core';
|
|
2
2
|
|
|
3
3
|
declare enum CpType {
|
|
4
4
|
SSH = "ssh",
|
|
@@ -7,11 +7,8 @@ declare enum CpType {
|
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
declare class CpPlugin extends InitxPlugin {
|
|
10
|
-
rules:
|
|
11
|
-
|
|
12
|
-
description: string;
|
|
13
|
-
}[];
|
|
14
|
-
handle(_ctx: InitxContext, cpType: CpType, ...others: string[]): Promise<void>;
|
|
10
|
+
rules: InitxMatcherRules;
|
|
11
|
+
handle(_ctx: InitxContext, cpType: CpType): Promise<void>;
|
|
15
12
|
[CpType.SSH](): Promise<void>;
|
|
16
13
|
[CpType.GPG](): Promise<void>;
|
|
17
14
|
[CpType.CWD](): Promise<void>;
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{existsSync as d,readdirSync as
|
|
1
|
+
import{existsSync as d,readdirSync as m,readFileSync as f}from"node:fs";import u from"node:os";import{resolve as a}from"node:path";import{cwd as S}from"node:process";import{InitxPlugin as h}from"@initx-plugin/core";import{log as i,inquirer as y,gpgList as g,c as k}from"@initx-plugin/utils";import G from"clipboardy";var n=(c=>(c.SSH="ssh",c.GPG="gpg",c.CWD="cwd",c))(n||{});class b extends h{rules=[{matching:"cp",description:"Copy SSH public key"}];async handle(e,t){if(!t||typeof this[t]!="function"){const r=n;i.error(`Please enter the copy type, Available types: ${Object.keys(r).map(s=>r[s]).join(", ")}`);return}await this[t]()}async[n.SSH](){const e=a(u.homedir(),".ssh");if(!d(e)){i.error(`SSH directory not found, path: ${e}`);return}const t=m(e).filter(o=>o.endsWith(".pub"));if(t.length===0){i.error("SSH key not found");return}let r;if(t.length===1){const[o]=t;r=o}else{const o=await y.select("Select SSH key",t);r=t[o]}const s=a(e,r),p=f(s,"utf8");this.copy(p),i.success("Key copied to clipboard")}async[n.GPG](){const e=await g();if(e.length===0){i.error("No GPG keys found");return}let t=0;e.length>1&&(t=await y.select("Select GPG key",e.map(({key:p,name:o,email:l})=>`${p} - ${o} <${l}>`)));const{key:r}=e[t],s=await k("gpg",["--armor","--export",r]);this.copy(s.content),i.success("GPG public key copied to clipboard")}async[n.CWD](){this.copy(S()),i.success("Current working directory copied to clipboard")}copy(e){G.writeSync(e)}}export{b as default};
|
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.22",
|
|
5
5
|
"description": "initx plugin, copy some text to clipboard",
|
|
6
6
|
"author": "imba97",
|
|
7
7
|
"license": "MIT",
|
|
@@ -24,31 +24,31 @@
|
|
|
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.31",
|
|
28
|
+
"@initx-plugin/utils": "^0.0.31",
|
|
29
29
|
"clipboardy": "^4.0.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@imba97/eslint-config": "^0.0.
|
|
33
|
-
"@types/node": "^22.
|
|
34
|
-
"bumpp": "^
|
|
35
|
-
"eslint": "^9.
|
|
36
|
-
"lint-staged": "^15.
|
|
37
|
-
"simple-git-hooks": "^2.
|
|
38
|
-
"typescript": "^5.
|
|
39
|
-
"unbuild": "^3.
|
|
40
|
-
"vitest": "^
|
|
32
|
+
"@imba97/eslint-config": "^0.0.6",
|
|
33
|
+
"@types/node": "^22.13.13",
|
|
34
|
+
"bumpp": "^10.1.0",
|
|
35
|
+
"eslint": "^9.23.0",
|
|
36
|
+
"lint-staged": "^15.5.0",
|
|
37
|
+
"simple-git-hooks": "^2.12.1",
|
|
38
|
+
"typescript": "^5.8.2",
|
|
39
|
+
"unbuild": "^3.5.0",
|
|
40
|
+
"vitest": "^3.0.9"
|
|
41
41
|
},
|
|
42
42
|
"simple-git-hooks": {
|
|
43
43
|
"pre-commit": "pnpm lint-staged"
|
|
44
44
|
},
|
|
45
45
|
"lint-staged": {
|
|
46
|
-
"*": "eslint --cache --
|
|
46
|
+
"*": "eslint --cache --fix"
|
|
47
47
|
},
|
|
48
48
|
"scripts": {
|
|
49
49
|
"stub": "unbuild --stub",
|
|
50
50
|
"build": "unbuild",
|
|
51
|
-
"lint": "eslint --cache
|
|
51
|
+
"lint": "eslint --cache",
|
|
52
52
|
"release": "bumpp"
|
|
53
53
|
}
|
|
54
54
|
}
|