-
Notifications
You must be signed in to change notification settings - Fork 0
/
executor.go
46 lines (40 loc) · 973 Bytes
/
executor.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
package nfcli
import (
"fmt"
"os"
"strings"
"github.com/muthuramanecs03g/nfcli/internal/nf/upf"
"github.com/muthuramanecs03g/nfcli/lib"
)
func Executor(in string) {
if PromptConfig.Nf == lib.NF_UPF {
// fmt.Println("Main: UPF")
upf.ExecutorUpf(in, PromptConfig)
}
if strings.HasPrefix(in, "upf") {
// fmt.Println("Main: UPF has prefix")
PromptConfig.Suggestion = &upf.UpfSuggestion
PromptConfig.IsEnable = true
PromptConfig.Prefix = "upf# "
PromptConfig.IsNf = true
PromptConfig.Nf = lib.NF_UPF
return
}
if PromptConfig.IsNf && PromptConfig.Nf != lib.NF_END {
return
}
if in == "exit" {
// fmt.Println("Main: exit")
if PromptConfig.IsNf {
// fmt.Println("Main: Changed to main")
PromptConfig.Suggestion = &MainSuggestion
PromptConfig.IsEnable = true
PromptConfig.Prefix = "nfcli# "
PromptConfig.IsNf = false
PromptConfig.Nf = NF_MAIN
return
}
fmt.Println("free5GC NF CLI Bye Bye Bye!!!")
os.Exit(0)
}
}