-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
96 lines (79 loc) · 2.13 KB
/
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
package main
import (
"fmt"
"github.com/charmbracelet/bubbles/table"
"SSH-Client/ui/authChoice"
"SSH-Client/ui/remoteChoice"
"SSH-Client/ui/sourceChoice"
)
// type listOptions struct {
// options []string
// }
// type Options struct {
// Operation *operationChoice.Selection
// }
// func updateOperation(msg tea.Msg, m Model) (tea.Model, tea.Cmd) {
// var option string
// // var selection operationChoice.Selection
// options := Options{
// Operation: &operationChoice.Selection{},
// }
// listOfStuff := listOptions{
// options: []string{
// "Log into a container",
// "Send commands to container(s)",
// "Push a local file to container(s)",
// "Pull a remote file from a container",
// "View available containers",
// },
// }
// model := operationChoice.InitialModelSelectionInput(listOfStuff.options, options.Operation, "Select the operation you would like to peform on the container(s):")
// need to store attributed auth and store selected hosts in model variable
type Model struct {
source string
sources []string
operation string
authorization string
table table.Model
state string
succeeded []authChoice.ConfigStatus
failed []authChoice.ConfigStatus
}
func main() {
m := Model{}
m.state = "source"
// initialize model w/ pointer and fields
// pre-check before starting loop, for config file present, docker engine running
controlLoop:
for {
switch state := m.state; state {
case "source":
var lol bool
var err error
m.source, m.state, err = sourceChoice.RunForm()
fmt.Printf("\n%v", m.source)
if (err != nil) || lol {
break controlLoop
}
case "remote":
// var sources []string
var err error
m.sources, m.state, err = remoteChoice.RunForm("config.json")
if err != nil {
break controlLoop
}
// case "operation":
// updateOperation(msg, m)
case "authentication":
var err error
m.succeeded, m.failed, m.state, err = authChoice.RunForm("config.json", m.sources)
if err != nil {
break controlLoop
}
// case "container table":
// updateTable(msg, m)
case "done":
break controlLoop
}
}
}