mirror of
https://github.com/Baipyrus/ProxySwitcher.git
synced 2024-12-25 12:11:46 +00:00
add config detection to debug command
This commit is contained in:
parent
c66937fdba
commit
2d126e6293
@ -1,7 +1,10 @@
|
||||
package proxy
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/Baipyrus/ProxySwitcher/util"
|
||||
@ -20,13 +23,21 @@ func mapCmdsToStr(commands []*util.Command) 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()
|
||||
proxyServer := proxy.Server
|
||||
if proxyServer == "" {
|
||||
proxyServer = "[N/A]"
|
||||
}
|
||||
|
||||
fmt.Println("\nSystem Proxy:")
|
||||
fmt.Println("System Proxy:")
|
||||
fmt.Printf("Enabled: %t\n", proxy.Enabled)
|
||||
fmt.Printf("Server: %s\n\n", proxyServer)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user