Skip to content

Commit

Permalink
app flags double hyphen format
Browse files Browse the repository at this point in the history
  • Loading branch information
0pcom committed Dec 22, 2023
1 parent 94ce565 commit da10f8f
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions pkg/visor/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ func (v *Visor) StartVPNClient(pk cipher.PubKey) error {
// we set the args in memory and pass it in `v.appL.StartApp`
// unlike the api method `StartApp` where `nil` is passed in `v.appL.StartApp` as args
// but the args are set in the config
v.conf.Launcher.Apps[index].Args = []string{"-srv", pk.Hex()}
v.conf.Launcher.Apps[index].Args = []string{"--srv", pk.Hex()}
maker := vpnEnvMaker(v.conf, v.dmsgC, v.dmsgDC, v.tpM.STCPRRemoteAddrs())
envs, err = maker()
if err != nil {
Expand Down Expand Up @@ -609,13 +609,13 @@ func (v *Visor) StartSkysocksClient(serverKey string) error {
// we set the args in memory and pass it in `v.appL.StartApp`
// unlike the api method `StartApp` where `nil` is passed in `v.appL.StartApp` as args
// but the args are set in the config
v.conf.Launcher.Apps[index].Args = []string{"-srv", pk.Hex()}
v.conf.Launcher.Apps[index].Args = []string{"--srv", pk.Hex()}
} else {
var pk cipher.PubKey
if err := pk.Set(v.GetSkysocksClientAddress()); err != nil {
return err
}
v.conf.Launcher.Apps[index].Args = []string{"-srv", pk.Hex()}
v.conf.Launcher.Apps[index].Args = []string{"--srv", pk.Hex()}
}

// check process manager availability
Expand Down Expand Up @@ -724,7 +724,7 @@ func (v *Visor) SetAppPassword(appName, password string) error {
v.log.Infof("Changing %s password to %q", appName, password)

const (
passcodeArgName = "-passcode"
passcodeArgName = "--passcode"
)
if err := v.conf.UpdateAppArg(v.appL, appName, passcodeArgName, password); err != nil {
return err
Expand Down Expand Up @@ -833,7 +833,7 @@ func (v *Visor) SetAppAddress(appName string, address string) error {
v.log.Infof("Setting %s addr to %v", appName, address)

const (
addrArg = "-addr"
addrArg = "--addr"
)
if err := v.conf.UpdateAppArg(v.appL, appName, addrArg, address); err != nil {
return err
Expand Down Expand Up @@ -863,7 +863,7 @@ func (v *Visor) SetAppPK(appName string, pk cipher.PubKey) error {
v.log.Infof("Changing %s PK to %q", appName, pk)

const (
pkArgName = "-srv"
pkArgName = "--srv"
)
if err := v.conf.UpdateAppArg(v.appL, appName, pkArgName, pk.String()); err != nil {
return err
Expand Down Expand Up @@ -892,7 +892,7 @@ func (v *Visor) SetAppDNS(appName string, dnsAddr string) error {
v.log.Infof("Changing %s DNS Address to %q", appName, dnsAddr)

const (
pkArgName = "-dns"
pkArgName = "--dns"
)

if err := v.conf.UpdateAppArg(v.appL, appName, pkArgName, dnsAddr); err != nil {
Expand All @@ -917,7 +917,7 @@ func (v *Visor) DoCustomSetting(appName string, customSetting map[string]string)
}

for field, value := range customSetting {
if err := v.conf.UpdateAppArg(v.appL, appName, fmt.Sprintf("-%s", field), value); err != nil {
if err := v.conf.UpdateAppArg(v.appL, appName, fmt.Sprintf("--%s", field), value); err != nil {
return err
}
}
Expand Down Expand Up @@ -1489,7 +1489,7 @@ func (v *Visor) GetVPNClientAddress() string {
for _, v := range v.conf.Launcher.Apps {
if v.Name == visorconfig.VPNClientName {
for index := range v.Args {
if v.Args[index] == "-srv" {
if v.Args[index] == "--srv" {
return v.Args[index+1]
}
}
Expand All @@ -1503,7 +1503,7 @@ func (v *Visor) GetSkysocksClientAddress() string {
for _, v := range v.conf.Launcher.Apps {
if v.Name == visorconfig.SkysocksClientAddr {
for index := range v.Args {
if v.Args[index] == "-srv" {
if v.Args[index] == "--srv" {
return v.Args[index+1]
}
}
Expand Down

0 comments on commit da10f8f

Please sign in to comment.