Skip to content

Commit

Permalink
Fix descriptions broken by template changes
Browse files Browse the repository at this point in the history
Signed-off-by: Emilijus Stankus <emilijus.stankus@nordsec.com>
  • Loading branch information
Emilijus Stankus committed Sep 29, 2023
1 parent 51e1048 commit 7be57f7
Show file tree
Hide file tree
Showing 17 changed files with 184 additions and 175 deletions.
119 changes: 72 additions & 47 deletions cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ func NewApp(version, environment, hash, daemonURL, salt string,
Action: cmd.SetAutoConnect,
BashComplete: cmd.SetAutoConnectAutoComplete,
ArgsUsage: SetAutoConnectArgsUsageText,
Description: SetAutoConnectDescription,
},
{
Name: "threatprotectionlite",
Expand All @@ -134,24 +135,27 @@ func NewApp(version, environment, hash, daemonURL, salt string,
Action: cmd.SetThreatProtectionLite,
BashComplete: cmd.SetBoolAutocomplete,
ArgsUsage: SetThreatProtectionLiteArgsUsageText,
Description: SetThreatProtectionLiteDescription,
},
{
Name: "defaults",
Usage: SetDefaultsUsageText,
Action: cmd.SetDefaults,
},
{
Name: "dns",
Usage: SetDNSUsageText,
Action: cmd.SetDNS,
ArgsUsage: SetDNSArgsUsageText,
Name: "dns",
Usage: SetDNSUsageText,
Action: cmd.SetDNS,
ArgsUsage: SetDNSArgsUsageText,
Description: SetDNSDescription,
},
{
Name: "firewall",
Usage: SetFirewallUsageText,
Action: cmd.SetFirewall,
ArgsUsage: fmt.Sprintf(
MsgSetBoolArgsUsage,
Name: "firewall",
Usage: SetFirewallUsageText,
Action: cmd.SetFirewall,
ArgsUsage: MsgSetBoolArgsUsage,
Description: fmt.Sprintf(
MsgSetBoolDescription,
SetFirewallUsageText,
"firewall",
"firewall",
Expand All @@ -164,35 +168,38 @@ func NewApp(version, environment, hash, daemonURL, salt string,
Action: cmd.SetFirewallMark,
},
{
Name: "ipv6",
Usage: SetIpv6UsageText,
Action: cmd.SetIpv6,
ArgsUsage: fmt.Sprintf(
MsgSetBoolArgsUsage,
Name: "ipv6",
Usage: SetIpv6UsageText,
Action: cmd.SetIpv6,
ArgsUsage: MsgSetBoolArgsUsage,
Description: fmt.Sprintf(
MsgSetBoolDescription,
SetIpv6UsageText,
"ipv6",
"ipv6",
),
BashComplete: cmd.SetBoolAutocomplete,
},
{
Name: "routing",
Usage: SetRoutingUsageText,
Action: cmd.SetRouting,
ArgsUsage: fmt.Sprintf(
MsgSetBoolArgsUsage,
Name: "routing",
Usage: SetRoutingUsageText,
Action: cmd.SetRouting,
ArgsUsage: MsgSetBoolArgsUsage,
Description: fmt.Sprintf(
MsgSetBoolDescription,
SetRoutingUsageText,
"routing",
"routing",
),
BashComplete: cmd.SetBoolAutocomplete,
},
{
Name: "analytics",
Usage: SetAnalyticsUsageText,
Action: cmd.SetAnalytics,
ArgsUsage: fmt.Sprintf(
MsgSetBoolArgsUsage,
Name: "analytics",
Usage: SetAnalyticsUsageText,
Action: cmd.SetAnalytics,
ArgsUsage: MsgSetBoolArgsUsage,
Description: fmt.Sprintf(
MsgSetBoolDescription,
SetAnalyticsUsageText,
"analytics",
"analytics",
Expand All @@ -204,8 +211,9 @@ func NewApp(version, environment, hash, daemonURL, salt string,
Usage: SetKillSwitchUsageText,
Action: cmd.SetKillSwitch,
BashComplete: cmd.SetBoolAutocomplete,
ArgsUsage: fmt.Sprintf(
MsgSetBoolArgsUsage,
ArgsUsage: MsgSetBoolArgsUsage,
Description: fmt.Sprintf(
MsgSetBoolDescription,
SetKillSwitchUsageText,
"killswitch",
"killswitch",
Expand All @@ -216,8 +224,9 @@ func NewApp(version, environment, hash, daemonURL, salt string,
Usage: SetNotifyUsageText,
Action: cmd.SetNotify,
BashComplete: cmd.SetBoolAutocomplete,
ArgsUsage: fmt.Sprintf(
MsgSetBoolArgsUsage,
ArgsUsage: MsgSetBoolArgsUsage,
Description: fmt.Sprintf(
MsgSetBoolDescription,
SetNotifyUsageText,
"notify",
"notify",
Expand All @@ -228,8 +237,9 @@ func NewApp(version, environment, hash, daemonURL, salt string,
Usage: SetObfuscateUsageText,
Action: cmd.SetObfuscate,
BashComplete: cmd.SetBoolAutocomplete,
ArgsUsage: fmt.Sprintf(
MsgSetBoolArgsUsage,
ArgsUsage: MsgSetBoolArgsUsage,
Description: fmt.Sprintf(
MsgSetBoolDescription,
SetObfuscateUsageText,
"obfuscate",
"obfuscate",
Expand All @@ -242,6 +252,7 @@ func NewApp(version, environment, hash, daemonURL, salt string,
Action: cmd.SetProtocol,
BashComplete: cmd.SetProtocolAutoComplete,
ArgsUsage: SetProtocolArgsUsageText,
Description: SetProtocolDescription,
Hidden: cmd.Except(config.Technology_OPENVPN),
},
{
Expand All @@ -250,20 +261,23 @@ func NewApp(version, environment, hash, daemonURL, salt string,
Action: cmd.SetTechnology,
BashComplete: cmd.SetTechnologyAutoComplete,
ArgsUsage: SetTechnologyArgsUsageText,
Description: SetTechnologyDescription,
},
{
Name: "meshnet",
Aliases: []string{"mesh"},
Usage: MsgSetMeshnetUsage,
ArgsUsage: MsgSetMeshnetArgsUsage,
Description: MsgSetMeshnetDescription,
Action: cmd.MeshSet,
BashComplete: cmd.SetBoolAutocomplete,
},
{
Name: "lan-discovery",
Usage: SetLANDiscoveryUsage,
ArgsUsage: fmt.Sprintf(
MsgSetBoolArgsUsage,
Name: "lan-discovery",
Usage: SetLANDiscoveryUsage,
ArgsUsage: MsgSetBoolArgsUsage,
Description: fmt.Sprintf(
MsgSetBoolDescription,
SetLANDiscoveryUsage,
"lan-discovery",
"lan-discovery",
Expand Down Expand Up @@ -302,6 +316,7 @@ func NewApp(version, environment, hash, daemonURL, salt string,
Action: cmd.Cities,
BashComplete: cmd.CitiesAutoComplete,
ArgsUsage: CitiesArgsUsageText,
Description: CitiesDescription,
},
{
Name: "connect",
Expand Down Expand Up @@ -385,6 +400,7 @@ func NewApp(version, environment, hash, daemonURL, salt string,
Action: cmd.Rate,
BashComplete: cmd.RateAutoComplete,
ArgsUsage: RateArgsUsageText,
Description: RateDescription,
},
{
Name: "register",
Expand Down Expand Up @@ -428,20 +444,23 @@ func NewApp(version, environment, hash, daemonURL, salt string,
Action: cmd.AllowlistAddPort,
BashComplete: cmd.AllowlistAddPortAutoComplete,
ArgsUsage: AllowlistAddPortArgsUsageText,
Description: AllowlistAddPortDescription,
},
{
Name: "ports",
Usage: AllowlistAddPortsUsageText,
Action: cmd.AllowlistAddPorts,
BashComplete: cmd.AllowlistAddPortsAutoComplete,
ArgsUsage: AllowlistAddPortsArgsUsageText,
Description: AllowlistAddPortsDescription,
},
{
Name: "subnet",
Usage: AllowlistAddSubnetUsageText,
Action: cmd.AllowlistAddSubnet,
BashComplete: cmd.AllowlistAddSubnetAutoComplete,
ArgsUsage: AllowlistAddSubnetArgsUsageText,
Description: AllowlistAddSubnetDescription,
},
},
},
Expand All @@ -461,20 +480,23 @@ func NewApp(version, environment, hash, daemonURL, salt string,
Action: cmd.AllowlistRemovePort,
BashComplete: cmd.AllowlistRemovePortAutoComplete,
ArgsUsage: AllowlistRemovePortArgsUsageText,
Description: AllowlistRemovePortArgsDescription,
},
{
Name: "ports",
Usage: AllowlistRemovePortsUsageText,
Action: cmd.AllowlistRemovePorts,
BashComplete: cmd.AllowlistRemovePortsAutoComplete,
ArgsUsage: AllowlistRemovePortsArgsUsageText,
Description: AllowlistRemovePortsArgsDescription,
},
{
Name: "subnet",
Usage: AllowlistRemoveSubnetUsageText,
Action: cmd.AllowlistRemoveSubnet,
BashComplete: cmd.AllowlistRemoveSubnetAutoComplete,
ArgsUsage: AllowlistRemoveSubnetArgsUsageText,
Description: AllowlistRemoveSubnetArgsDescription,
},
},
},
Expand Down Expand Up @@ -508,10 +530,11 @@ func fileshareCommand(c *cmd) *cli.Command {
Before: c.IsFileshareDaemonReachable,
Subcommands: []*cli.Command{
{
Name: FileshareSendName,
Action: c.FileshareSend,
Usage: MsgFileshareSendUsage,
ArgsUsage: MsgFileshareSendArgsUsage,
Name: FileshareSendName,
Action: c.FileshareSend,
Usage: MsgFileshareSendUsage,
ArgsUsage: MsgFileshareSendArgsUsage,
Description: MsgFileshareSendDescription,
Flags: []cli.Flag{
&cli.BoolFlag{
Name: flagFileshareNoWait,
Expand All @@ -521,10 +544,11 @@ func fileshareCommand(c *cmd) *cli.Command {
BashComplete: c.FileshareAutoCompletePeers,
},
{
Name: FileshareAcceptName,
Action: c.FileshareAccept,
Usage: MsgFileshareAcceptUsage,
ArgsUsage: MsgFileshareAcceptArgsUsage,
Name: FileshareAcceptName,
Action: c.FileshareAccept,
Usage: MsgFileshareAcceptUsage,
ArgsUsage: MsgFileshareAcceptArgsUsage,
Description: MsgFileshareAcceptDescription,
Flags: []cli.Flag{
&cli.PathFlag{
Name: flagFilesharePath,
Expand All @@ -538,10 +562,11 @@ func fileshareCommand(c *cmd) *cli.Command {
BashComplete: c.FileshareAutoCompleteTransfersAccept,
},
{
Name: FileshareListName,
Action: c.FileshareList,
Usage: MsgFileshareListUsage,
ArgsUsage: MsgFileshareListArgsUsage,
Name: FileshareListName,
Action: c.FileshareList,
Usage: MsgFileshareListUsage,
ArgsUsage: MsgFileshareListArgsUsage,
Description: MsgFileshareListDescription,
Flags: []cli.Flag{
&cli.BoolFlag{
Name: flagFileshareListIn,
Expand Down Expand Up @@ -586,7 +611,7 @@ func meshnetCommand(c *cmd) *cli.Command {
Aliases: []string{"f"},
},
},
ArgsUsage: PeerListArgsUsageText,
Description: PeerListDescription,
BashComplete: c.FiltersAutoComplete,
},
{
Expand Down
13 changes: 6 additions & 7 deletions cli/cli_allowlist_add_port.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,19 @@ import (
"github.com/urfave/cli/v2"
)

// AllowlistAddPortUsageText is shown next to port command by nordvpn allowlist add --help
const AllowlistAddPortUsageText = "Adds port to the allowlist"

// AllowlistAddPortArgsUsageText is shown on nordvpn allowlist add port --help
const AllowlistAddPortArgsUsageText = `<port> [protocol <protocol>]
Use this command to allowlist the UDP and TCP port.
// Allowlist add port help text
const (
AllowlistAddPortUsageText = "Adds port to the allowlist"
AllowlistAddPortArgsUsageText = `<port> [protocol <protocol>]`
AllowlistAddPortDescription = `Use this command to allowlist the UDP and TCP port.
Example: 'nordvpn allowlist add port 22'
Optionally, protocol can be provided to specify which protocol should be allowlisted.
Supported values for <protocol>: TCP, UDP
Example: 'nordvpn allowlist add port 22 protocol TCP'`
)

func (c *cmd) AllowlistAddPort(ctx *cli.Context) error {
args := ctx.Args()
Expand Down
13 changes: 6 additions & 7 deletions cli/cli_allowlist_add_ports.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,19 @@ import (
"github.com/urfave/cli/v2"
)

// AllowlistAddPortsUsageText is show next to ports command by nordvpn allowlist add --help
const AllowlistAddPortsUsageText = "Adds port range to the allowlist"

// AllowlistAddPortsArgsUsageText is shown by nordvpn allowlist add ports --help
const AllowlistAddPortsArgsUsageText = `<port_from> <port_to> [protocol <protocol>]
Use this command to allowlist the UDP and TCP ports.
// Allowlist add ports help text
const (
AllowlistAddPortsUsageText = "Adds port range to the allowlist"
AllowlistAddPortsArgsUsageText = `<port_from> <port_to> [protocol <protocol>]`
AllowlistAddPortsDescription = `Use this command to allowlist the UDP and TCP ports.
Example: 'nordvpn allowlist add ports 3000 8000'
Optionally, protocol can be provided to specify which protocol should be allowlisted.
Supported values for <protocol>: TCP, UDP
Example: 'nordvpn allowlist add ports 3000 8000 protocol TCP'`
)

func (c *cmd) AllowlistAddPorts(ctx *cli.Context) error {
args := ctx.Args()
Expand Down
13 changes: 6 additions & 7 deletions cli/cli_allowlist_add_subnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,17 @@ import (
"github.com/urfave/cli/v2"
)

// AllowlistAddSubnetUsageText is shown next to subnet command by nordvpn allowlist add --help
const AllowlistAddSubnetUsageText = "Adds subnet to the allowlist"

// AllowlistAddSubnetArgsUsageText is shown by nordvpn allowlist add subnet --help
const AllowlistAddSubnetArgsUsageText = `<address>
Use this command to allowlist subnet.
// Allowlist add subnet help text
const (
AllowlistAddSubnetUsageText = "Adds subnet to the allowlist"
AllowlistAddSubnetArgsUsageText = `<address>`
AllowlistAddSubnetDescription = `Use this command to allowlist subnet.
Example: 'nordvpn allowlist add subnet 192.168.1.1/24'
Notes:
Address should be in CIDR notation`
)

func (c *cmd) AllowlistAddSubnet(ctx *cli.Context) error {
args := ctx.Args()
Expand Down
13 changes: 6 additions & 7 deletions cli/cli_allowlist_remove_port.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,19 @@ import (
"github.com/urfave/cli/v2"
)

// AllowlistRemovePortUsageText is shown next to port command by nordvpn allowlist remove --help
const AllowlistRemovePortUsageText = "Removes port from the allowlist"

// AllowlistDeletePort is shown by nordvpn allowlist remove port --help
const AllowlistRemovePortArgsUsageText = `<port> [protocol <protocol>]
Use this command to remove a port from the allowlist.
// Allowlist remove port help text
const (
AllowlistRemovePortUsageText = "Removes port from the allowlist"
AllowlistRemovePortArgsUsageText = `<port> [protocol <protocol>]`
AllowlistRemovePortArgsDescription = `Use this command to remove a port from the allowlist.
Example: 'nordvpn allowlist remove port 22'
Optionally, protocol can be provided to specify which protocol should be removed from the allowlist.
Supported values for <protocol>: TCP, UDP
Example: 'nordvpn allowlist remove port 22 protocol TCP'`
)

func (c *cmd) AllowlistRemovePort(ctx *cli.Context) error {
args := ctx.Args()
Expand Down

0 comments on commit 7be57f7

Please sign in to comment.