johankit 0.1.2 → 0.1.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.
- package/package.json +1 -1
- package/src/cli/commands/copy.ts +8 -13
- package/package-lock.json +0 -4458
package/package.json
CHANGED
package/src/cli/commands/copy.ts
CHANGED
|
@@ -2,22 +2,17 @@ import { scanDir } from "../../core/scan";
|
|
|
2
2
|
import { copyToClipboard } from "../../core/clipboard";
|
|
3
3
|
|
|
4
4
|
export async function copy(input: string | string[]) {
|
|
5
|
-
let snapshot;
|
|
5
|
+
let snapshot: any[] = [];
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
return fileSnapshot[0];
|
|
14
|
-
});
|
|
15
|
-
} else {
|
|
16
|
-
snapshot = scanDir(input);
|
|
7
|
+
const paths = Array.isArray(input) ? input : [input];
|
|
8
|
+
|
|
9
|
+
for (const p of paths) {
|
|
10
|
+
const scanned = scanDir(p);
|
|
11
|
+
snapshot.push(...scanned);
|
|
17
12
|
}
|
|
18
13
|
|
|
19
14
|
const clipboardJSON = JSON.stringify(snapshot, null, 2);
|
|
20
|
-
|
|
15
|
+
|
|
21
16
|
try {
|
|
22
17
|
await copyToClipboard(clipboardJSON);
|
|
23
18
|
} catch (err) {
|
|
@@ -25,4 +20,4 @@ export async function copy(input: string | string[]) {
|
|
|
25
20
|
}
|
|
26
21
|
|
|
27
22
|
return clipboardJSON;
|
|
28
|
-
}
|
|
23
|
+
}
|