Skip to content

Commit d5ce4b2

Browse files
committed
Rough skeleton for comms cli tool
1 parent 098497d commit d5ce4b2

File tree

1 file changed

+58
-0
lines changed
  • packages/cli/commands/user-comms

1 file changed

+58
-0
lines changed
+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
import { select } from "@inquirer/prompts"
2+
import { Command } from "commander"
3+
import nunjucks from "nunjucks"
4+
import { pncMaintenance } from "./pncMaintenance"
5+
import { pncMaintenanceExtended } from "./pncMaintenanceExtended"
6+
7+
nunjucks.configure("templates", { autoescape: true })
8+
9+
export function userComms(): Command {
10+
const program = new Command("user-comms")
11+
12+
program.description("A way to send group communications to all users").action(async () => {
13+
const templateChoice = await select({
14+
message: "Select a template to use",
15+
choices: [
16+
{
17+
name: "PNC Scheduled Maintenance",
18+
value: "PNC maintenance",
19+
description: "Notify users of upcoming scheduled maintenance"
20+
},
21+
{
22+
name: "PNC Maintenance Window Extended",
23+
value: "PNC maintenance extended",
24+
description: "Notify users that the maintenance window has been extended"
25+
},
26+
27+
{
28+
name: "Outage Notification",
29+
value: "Outage",
30+
description: "Notify users about an ongoing outage"
31+
},
32+
{
33+
name: "Outage Resolved",
34+
value: "Outage Resolved",
35+
description: "Notify users that the outage has been resolved"
36+
}
37+
]
38+
})
39+
40+
console.log(`You selected: ${templateChoice}`)
41+
switch (templateChoice) {
42+
case "PNC maintenance":
43+
pncMaintenance()
44+
break
45+
case "PNC maintenance extended":
46+
pncMaintenanceExtended()
47+
break
48+
case "Outage":
49+
console.log("Outage")
50+
break
51+
case "Outage Resolved":
52+
console.log("Outage resolved")
53+
break
54+
}
55+
})
56+
57+
return program
58+
}

0 commit comments

Comments
 (0)