-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.ts
More file actions
30 lines (26 loc) · 672 Bytes
/
index.ts
File metadata and controls
30 lines (26 loc) · 672 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env node
import scriptsRunner from "./source/scripts";
import stylishPrint from "./source/stylePrint";
// Function to handle interruption (Ctrl + C)
const handleInterrupt = () => {
process.exit(1);
};
// Set up the interrupt event listener
process.on("SIGINT", handleInterrupt);
// Your Enquirer prompt
const ScriptIntruption = async () => {
try {
await scriptsRunner();
} catch (error) {
stylishPrint(
`
Oh, Ok
hope See you again! ❣️`
);
} finally {
// Remove the event listener when the prompt is completed
process.removeListener("SIGINT", handleInterrupt);
}
};
// Call the function
ScriptIntruption();