Skip to content

Commit

Permalink
Fix proxy group selector
Browse files Browse the repository at this point in the history
  • Loading branch information
WindSpiritSR committed Oct 4, 2020
1 parent 7a89da7 commit e07b915
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
5 changes: 1 addition & 4 deletions model/string.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,7 @@ const (
PROMPT_MODEL_LABEL = "Select Proxy Mode"

PROMPT_PROXY_LABEL = "Proxy Mode"
PROMPT_PROXY_ITEM_PROXY = "Proxy"
PROMPT_PROXY_ITEM_DOMESTIC = "Domestic"
PROMPT_PROXY_ITEM_GLOBAL = "Global"
PROMPT_PROXY_ITEM_OTHERS = "Others"
PROMPT_PROXY_ITEM_ALL = "GLOBAL"
PROMPT_PROXY_ITEM_LATENCY_TEST = "Latency Test"

PROMPT_PROXY_GLOBAL_GROUPNAME = "GLOBAL"
Expand Down
10 changes: 8 additions & 2 deletions step/switch_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,16 @@ func (sp SwitchProxy) Run() error {
Name string
}

var proxyGroup []string
for name, group := range proxies.Proxies {
if group.Type.Is(C.Selector) && name != model.PROMPT_PROXY_ITEM_ALL {
proxyGroup = append(proxyGroup, name)
}
}

prompt := promptui.Select{
Label: model.PROMPT_PROXY_LABEL,
Items: []string{model.PROMPT_PROXY_ITEM_PROXY, model.PROMPT_PROXY_ITEM_DOMESTIC,
model.PROMPT_PROXY_ITEM_GLOBAL, model.PROMPT_PROXY_ITEM_OTHERS},
Items: proxyGroup,
}
_, proxyMode, err := prompt.Run()
if err != nil {
Expand Down

0 comments on commit e07b915

Please sign in to comment.