@diuyuy/snippet-generator 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.
- package/README.md +0 -2
- package/generate-snippet.ts +10 -1
- package/package.json +1 -1
package/README.md
CHANGED
package/generate-snippet.ts
CHANGED
|
@@ -24,6 +24,11 @@ export async function generateSnippet(allFiles: string[]) {
|
|
|
24
24
|
const buffer = fs.readFileSync(answer);
|
|
25
25
|
let texts = buffer.toString();
|
|
26
26
|
|
|
27
|
+
const name = await input({
|
|
28
|
+
message: "Snippet name:",
|
|
29
|
+
required: true,
|
|
30
|
+
});
|
|
31
|
+
|
|
27
32
|
const prefix = await input({
|
|
28
33
|
message: "prefix:",
|
|
29
34
|
required: true,
|
|
@@ -51,7 +56,11 @@ export async function generateSnippet(allFiles: string[]) {
|
|
|
51
56
|
spinner.start();
|
|
52
57
|
const body = texts.split("\n");
|
|
53
58
|
|
|
54
|
-
const snippet = JSON.stringify(
|
|
59
|
+
const snippet = JSON.stringify(
|
|
60
|
+
{ [name]: { prefix, description, body } },
|
|
61
|
+
null,
|
|
62
|
+
2
|
|
63
|
+
).slice(1, -1);
|
|
55
64
|
await clipboard.write(snippet);
|
|
56
65
|
|
|
57
66
|
spinner.stop();
|