mirror of
https://github.com/Baipyrus/ProxySwitcher.git
synced 2024-12-26 12:41:45 +00:00
add config detection to debug command
This commit is contained in:
parent
c66937fdba
commit
2d126e6293
@ -1,7 +1,10 @@
|
|||||||
package proxy
|
package proxy
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/Baipyrus/ProxySwitcher/util"
|
"github.com/Baipyrus/ProxySwitcher/util"
|
||||||
@ -20,13 +23,21 @@ func mapCmdsToStr(commands []*util.Command) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func Debug(cfgFile string) {
|
func Debug(cfgFile string) {
|
||||||
|
path, _ := filepath.Abs(cfgFile)
|
||||||
|
if _, err := os.Stat(path); errors.Is(err, os.ErrNotExist) {
|
||||||
|
path = "[N/A]"
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Printf("\nConfig:\n")
|
||||||
|
fmt.Printf("%s\n\n", path)
|
||||||
|
|
||||||
proxy, _ := ReadSystemProxy()
|
proxy, _ := ReadSystemProxy()
|
||||||
proxyServer := proxy.Server
|
proxyServer := proxy.Server
|
||||||
if proxyServer == "" {
|
if proxyServer == "" {
|
||||||
proxyServer = "[N/A]"
|
proxyServer = "[N/A]"
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println("\nSystem Proxy:")
|
fmt.Println("System Proxy:")
|
||||||
fmt.Printf("Enabled: %t\n", proxy.Enabled)
|
fmt.Printf("Enabled: %t\n", proxy.Enabled)
|
||||||
fmt.Printf("Server: %s\n\n", proxyServer)
|
fmt.Printf("Server: %s\n\n", proxyServer)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user