-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.ts
More file actions
50 lines (48 loc) · 1.31 KB
/
main.ts
File metadata and controls
50 lines (48 loc) · 1.31 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import { Select, Toggle, colors } from "cliffy";
import { Graph } from "./graph.ts";
export const verbose = await Toggle.prompt("Show the time?");
const graph = new Graph(
await Select.prompt({
message: "Choose a graph",
options: ["1", "2", "3", "gross", "ganzGross", "ganzGanzGross"],
}),
verbose
);
while (true) {
const command = await Select.prompt({
message: "What do you want to see?",
options: [
{ name: "Size of graph", value: "graphSize" },
{
name: "List of nodes",
value: "graphNodes",
},
Select.separator("---------"),
{ name: "Size of subgraphs", value: "subgraphsSize" },
{ name: "List of subgraphs", value: "subgraphsNodes" },
{ name: "Measure Time with decorator", value: "measureTime"}
],
});
switch (command) {
case "graphSize":
console.log(
`The graph has ${colors.magenta(graph.size.toString())} nodes`
);
break;
case "graphNodes":
console.log(graph.nodes);
break;
case "subgraphsSize":
console.log(
`The graph has ${colors.magenta(
graph.subGraphs.length.toString()
)} subgraphs`
);
break;
case "subgraphsNodes":
console.log(graph.subGraphs);
break;
case "measureTime":
graph.printTimeAfterFunction();
}
}