Skip to content

Commit

Permalink
add flags "wifi-band" and "wifi-channel"
Browse files Browse the repository at this point in the history
  • Loading branch information
jkt628 committed Feb 7, 2025
1 parent 15c5d91 commit 01a644c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cmd/network_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ func init() {
networkUpdateCmd.Flags().String("wifi-ssid", "", "SSID for wifi connection")
networkUpdateCmd.Flags().String("wifi-auth", "", "Used authentication: open, wep, wpa-psk")
networkUpdateCmd.Flags().String("wifi-psk", "", "Shared authentication key for wep or wpa")
networkUpdateCmd.Flags().String("wifi-band", "", "Wifi band required for mode 'ap': a for 5GHz, bg for 2.4GHz")
networkUpdateCmd.Flags().Int("wifi-channel", 0, "Wifi channel required for mode 'ap'")

networkUpdateCmd.Flags().BoolP("disabled", "e", false, "Disable interface")

Expand All @@ -108,6 +110,10 @@ func init() {
return []string{"open", "wep", "wpa-psk"}, cobra.ShellCompDirectiveNoFileComp
})
networkUpdateCmd.RegisterFlagCompletionFunc("wifi-psk", cobra.NoFileCompletions)
networkUpdateCmd.RegisterFlagCompletionFunc("wifi-band", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
return []string{"a", "bg"}, cobra.ShellCompDirectiveNoFileComp
})
networkUpdateCmd.RegisterFlagCompletionFunc("wifi-channel", cobra.NoFileCompletions)

networkUpdateCmd.RegisterFlagCompletionFunc("disabled", boolCompletions)

Expand Down Expand Up @@ -162,6 +168,8 @@ func helperWifiConfig(cmd *cobra.Command, options map[string]interface{}) {
{Arg: "wifi-ssid", ApiKey: "ssid"},
{Arg: "wifi-auth", ApiKey: "auth"},
{Arg: "wifi-psk", ApiKey: "psk"},
{Arg: "wifi-band", ApiKey: "band"},
{Arg: "wifi-channel", ApiKey: "channel"},
}

wifiConfig := parseNetworkArgs(cmd, args)
Expand Down

0 comments on commit 01a644c

Please sign in to comment.