mirror of
https://github.com/Baipyrus/ProxySwitcher.git
synced 2024-12-27 05:01:45 +00:00
initialize unset command
This commit is contained in:
parent
3bd3bea69a
commit
bf7c5b41d9
39
cmd/unset.go
Normal file
39
cmd/unset.go
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
package cmd
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
"os/signal"
|
||||||
|
"syscall"
|
||||||
|
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
)
|
||||||
|
|
||||||
|
// unsetCmd represents the unset command
|
||||||
|
var unsetCmd = &cobra.Command{
|
||||||
|
Use: "unset",
|
||||||
|
Short: "Disable the current internet proxy settings",
|
||||||
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
|
fmt.Printf("Unsetting Proxy Settings...\n")
|
||||||
|
|
||||||
|
// 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(unsetCmd)
|
||||||
|
|
||||||
|
// Here you will define your flags and configuration settings.
|
||||||
|
|
||||||
|
// Cobra supports Persistent Flags which will work for this command
|
||||||
|
// and all subcommands, e.g.:
|
||||||
|
// unsetCmd.PersistentFlags().String("foo", "", "A help for foo")
|
||||||
|
|
||||||
|
// Cobra supports local flags which will only run when this command
|
||||||
|
// is called directly, e.g.:
|
||||||
|
// unsetCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user