Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved UX by using subcommands #123

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

sdushantha
Copy link

@sdushantha sdushantha commented Dec 12, 2024

I've attempted to improve the UX by using Grumble's ability to have subcommands. This prevents us from having long commands with underscores that may a little uncomfortable type. Using subcommands may also make it intuitive to type out the commands as its similar to popular tools such as Docker.

Commands:
=========
  autoroute                    Setup everything for you (interfaces, routes & tunnel)
  certificate-fingerprint, cf  Show the current selfcert fingerprint
  clear                        clear the screen
  connect-agent, ca            Attempt to connect to a bind agent
  exit                         exit the shell
  help                         use 'help [command]' for command help
  ifconfig                     Show agent interfaces
  interface, if                Manage interfaces
  listener                     Manage listener
  route                        Manage routes
  session                      Change the current relay agent
  tunnel                       Manage tunnels

Sub Commands:
=============

interface:
  create  Create a new tuntap interface
  ls      List available tuntap interfaces
  rm      Remove a tuntap interface

listener:
  add   Listen on the agent and redirect connections to the desired address
  ls    List currently running listeners
  stop  Stop a listener

route:
  add  Add a route to a network interface
  ls   List available routes
  rm   Remove a route

tunnel:
  ls     List active tunnels
  start  Start relaying connection to the current agent
  stop   Stop the tunnel

Other minor changes that have been made

  • Added two character aliases for certificate-fingerprint, interface and connect-agent
  • Added a -no-banner flag to proxy to have the option not display the banner
  • Allow deletion of interfaces using index and interface name
  • Use updated version of Grumble by specifying most recent commit hash as there has been no releases after v1.3.1. This may currently be unnecessary, but I'm working the ability to enable Grumble's Readline Vim mode through a flag or config in Ligolo-ng
  • Use arguments instead of flags to reduce characters in commands (please see caveat section below)

Caveats
I believe using arguments instead of flags is more appropriate as values such as ip for the connect-agent is something that is required. But an issue arises in the command for removing routes because if values were not provided, it would then allow the user to select the routes to delete interactively. Grumble does allow optional arguments, but I haven't figured out how to use it. If I can have some help to make optional flag values into optional argument, then we can bring back the interactive selection. Otherwise we'd either have to drop the interactive selection or use flags instead of arguments.

Notice: This is my first time writing code in Golang, so please let test the code extra carefully to make sure I havent broken anything even though everything works seems to work fine on my end.

- Using Grumble's subcommands rather than underscore seprated
  subcommands
- Using hypenes instead of underscores in long two worded commands
- Using two character aliases instead of long variations of the same
  command
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant