2024-08-30 14:15:40 +00:00
|
|
|
package cmd
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"os"
|
|
|
|
"os/signal"
|
|
|
|
"syscall"
|
|
|
|
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
)
|
|
|
|
|
|
|
|
// saveCmd represents the save command
|
|
|
|
var saveCmd = &cobra.Command{
|
|
|
|
Use: "save",
|
2024-08-30 14:30:56 +00:00
|
|
|
Short: "Save a new internet proxy config",
|
2024-08-30 14:15:40 +00:00
|
|
|
Run: func(cmd *cobra.Command, args []string) {
|
2024-08-30 14:30:56 +00:00
|
|
|
fmt.Printf("Saving New Proxy Config...\n")
|
2024-08-30 14:15:40 +00:00
|
|
|
|
|
|
|
// Block process until interrupted
|
|
|
|
done := make(chan os.Signal, 1)
|
|
|
|
signal.Notify(done, syscall.SIGINT, syscall.SIGTERM)
|
|
|
|
fmt.Println("Blocking, press ctrl+c to continue...")
|
|
|
|
<-done
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
rootCmd.AddCommand(saveCmd)
|
|
|
|
|
|
|
|
// Here you will define your flags and configuration settings.
|
|
|
|
|
|
|
|
// Cobra supports Persistent Flags which will work for this command
|
|
|
|
// and all subcommands, e.g.:
|
|
|
|
// saveCmd.PersistentFlags().String("foo", "", "A help for foo")
|
|
|
|
|
|
|
|
// Cobra supports local flags which will only run when this command
|
|
|
|
// is called directly, e.g.:
|
|
|
|
// saveCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
|
|
|
|
}
|