-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
44 lines (38 loc) · 938 Bytes
/
main.go
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
package main
import (
"errors"
"log"
"os"
"github.com/pterm/pterm"
"github.com/the-r3aper7/stock-price-cli/src"
)
func main() {
if _, err := os.Stat("config.json"); errors.Is(err, os.ErrNotExist) {
os.Create("config.json")
}
var options []string
options = append(options, "START Session")
options = append(options, "ADD Symbol")
options = append(options, "EDIT Symbol")
options = append(options, "REMOVE Symbol")
options = append(options, "Exit")
for {
selectedOption, _ := pterm.DefaultInteractiveSelect.WithOptions(options).Show()
switch selectedOption {
case "START Session":
src.TableRender()
case "ADD Symbol":
status := src.AddSymbol()
log.Println(status)
case "EDIT Symbol":
status := src.EditSymbol()
log.Println(status)
case "REMOVE Symbol":
status := src.DeleteSymbol()
log.Println(status)
case "Exit":
log.Println("Exiting stock-price-cli...")
os.Exit(0)
}
}
}