mirror of
https://github.com/Baipyrus/ProxySwitcher.git
synced 2024-12-27 05:01:45 +00:00
prepare prompting for config data
This commit is contained in:
parent
a1ff03de66
commit
7c52c2d5d0
15
cmd/save.go
15
cmd/save.go
@ -2,9 +2,6 @@ package cmd
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
|
||||||
"os/signal"
|
|
||||||
"syscall"
|
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
@ -14,13 +11,13 @@ var saveCmd = &cobra.Command{
|
|||||||
Use: "save",
|
Use: "save",
|
||||||
Short: "Save a new internet proxy config",
|
Short: "Save a new internet proxy config",
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
fmt.Printf("Saving New Proxy Config...\n")
|
var name string
|
||||||
|
fmt.Print("Name: ")
|
||||||
|
fmt.Scanln(&name)
|
||||||
|
|
||||||
// Block process until interrupted
|
var command string
|
||||||
done := make(chan os.Signal, 1)
|
fmt.Print("Command? ")
|
||||||
signal.Notify(done, syscall.SIGINT, syscall.SIGTERM)
|
fmt.Scanln(&command)
|
||||||
fmt.Println("Blocking, press ctrl+c to continue...")
|
|
||||||
<-done
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user