Timac / VPNStatus

VPNStatus, a replacement for macOS builtin VPN Status
https://blog.timac.org/2018/0719-vpnstatus/
MIT License
221 stars 31 forks source link

vpnutil: Update 'usage' to mention 'list' option #26

Closed Tormen closed 11 months ago

Tormen commented 11 months ago

Ability to list all VPNs and their status: Minimum: Name of VPN (as needed for start and stop command, as well as status of VPN (I imagine the possibilities would be: connected, disconnected, connecting, ...).

Make this feature accessible via a 3rd command parameter (instead of start/stop): Something like list.

Output format: I don't really mind. The possibilities I see:

This would really be useful. Especially as the MacOS built-in tools don't seem to be able :/

Please let me know what would be needed in terms of financial sponsoring for this item. Thanks a lot in advance!

Timac commented 11 months ago

Hey @Tormen ,

The vpnutil command line tool already supports a list parameter. When running the command vpnutil list, you will see an output like:

VPN1 Connected
VPN2 Disconnected
VPN3 Disconnected

where VPN1, VPN2 and VPN3 are the names of the VPNs.

I assume that you would prefer to get a JSON output format like:

{
  "VPN1": {
    "status": "Connected"
  },
  "VPN2": {
    "status": "Disconnected"
  },
  "VPN3": {
    "status": "Disconnected"
  }
}

Would this JSON work for you? Is there anything missing in this output that you would like to see?

Tormen commented 11 months ago

Hi @Timac ,

Thank you!

In this case I would suggest the following to avoid similar confusion for others: Could you please change the output when calling "vpnutil" to show that there is such a list parameter ?

As for me the "Usage" did NOT talk about "list" I (had to assume) that there is no list parameter :D

This is what I see when executing vpnutil without parameters (latest stable precompiled version, downloaded today from this GitHub):

Usage: vpnutil [start|stop] [VPN name]
Examples:
     To start the VPN called 'MyVPN':
     vpnutil start MyVPN

     To stop the VPN called 'MyVPN':
     vpnutil stop MyVPN

     To list all available VPNs and their state:
     vpnutil list

     To get the status of the VPN called 'MyVPN':
     vpnutil status MyVPN

Copyright © 2018-2023 Alexandre Colucci
blog.timac.org
Tormen commented 11 months ago

Hi @Timac ,

I had another look at the current output of the list command and:

The output of the list command could be improved by using a "TAB" character, instead of "SPACE" to separate the NAME of the VPN and the status, as the VPN NAME /can/ also contain spaces.

Tormen

Timac commented 11 months ago

@Tormen Thanks again for the great suggestions. I implemented 2 changes:

{
  "VPNs" : [
    {
      "name" : "VPN1",
      "status" : "Connected"
    },
    {
      "name" : "VPN2",
      "status" : "Disconnected"
    },
    {
      "name" : "VPN3",
      "status" : "Disconnected"
    }
  ]
}