Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion client/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ func ReadPassword(repeat bool) (string, error) {
}

func PrintErrorString(err string) {
if term.IsTerminal(int(os.Stderr.Fd())) {
if term.IsTerminal(syscall.Stderr) {
fmt.Fprintln(os.Stderr, "\033[1;31mError:\033[0m", err)
} else {
fmt.Fprintln(os.Stderr, "Error:", err)
Expand Down
26 changes: 13 additions & 13 deletions cmd/network_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func init() {

type NetworkArg struct {
Arg string
ApiKey string
Field string
IsArray bool
IsInt bool
}
Expand All @@ -155,21 +155,21 @@ func parseNetworkArgs(cmd *cobra.Command, args []NetworkArg) map[string]any {
}

if err == nil && changed && cmd.Flags().Changed(arg.Arg) {
networkConfig[arg.ApiKey] = val
networkConfig[arg.Field] = val
}
}
return networkConfig
}

func helperIpConfig(version string, cmd *cobra.Command, options map[string]any) {
args := []NetworkArg{
{Arg: version + "-gateway", ApiKey: "gateway"},
{Arg: version + "-method", ApiKey: "method"},
{Arg: version + "-addr-gen-mode", ApiKey: "addr_gen_mode"},
{Arg: version + "-privacy", ApiKey: "ip6_privacy"},
{Arg: version + "-address", ApiKey: "address", IsArray: true},
{Arg: version + "-nameserver", ApiKey: "nameservers", IsArray: true},
{Arg: version + "-route-metric", ApiKey: "route_metric", IsInt: true},
{Arg: version + "-gateway", Field: "gateway"},
{Arg: version + "-method", Field: "method"},
{Arg: version + "-addr-gen-mode", Field: "addr_gen_mode"},
{Arg: version + "-privacy", Field: "ip6_privacy"},
{Arg: version + "-address", Field: "address", IsArray: true},
{Arg: version + "-nameserver", Field: "nameservers", IsArray: true},
{Arg: version + "-route-metric", Field: "route_metric", IsInt: true},
}

ipConfig := parseNetworkArgs(cmd, args)
Expand All @@ -180,10 +180,10 @@ func helperIpConfig(version string, cmd *cobra.Command, options map[string]any)

func helperWifiConfig(cmd *cobra.Command, options map[string]any) {
args := []NetworkArg{
{Arg: "wifi-mode", ApiKey: "mode"},
{Arg: "wifi-ssid", ApiKey: "ssid"},
{Arg: "wifi-auth", ApiKey: "auth"},
{Arg: "wifi-psk", ApiKey: "psk"},
{Arg: "wifi-mode", Field: "mode"},
{Arg: "wifi-ssid", Field: "ssid"},
{Arg: "wifi-auth", Field: "auth"},
{Arg: "wifi-psk", Field: "psk"},
}

wifiConfig := parseNetworkArgs(cmd, args)
Expand Down