xetys / hetzner-kube

A CLI tool for provisioning kubernetes clusters on Hetzner Cloud
Apache License 2.0
745 stars 116 forks source link

Developer experience improvement (DX initiative) #234

Open mavimo opened 5 years ago

mavimo commented 5 years ago

Hi guys, there are some "bug" on user experience and I'll like to fix it, but before start I think we should find a solution that should match the expectation of much people as possibile.

Command consistency

As end-user there are command that are not consistent on usage, some time we use flag, some time we need to user args, eg:

Same for

etc.

Maybe we should define the standard behaviour we will like to use and refactor other commands in order to be consistent.

Debug mode

There is a --debug flag defined on the root command but other command do not honor it, maybe we should allow all command to use this information when required.

Command listing

The hetzner-cloud list only the first level command, so user should enter in each command to detect the list of available subcommand, maybe we should list all command we have as doc? Something like:

A tool for creating and managing kubernetes clusters on Hetzner Cloud.

Usage:
  hetzner-kube [command]

Available Commands:
  cluster     view and manage kubernetes clusters, include subcommands:
     - add-external-worker    adds an existing server to the cluster
     - add-worker             add worker nodes
     - addon                  manages addons for kubernetes clusters
     - create                 creates a cluster
     - delete                 removes a cluster and deletes the associated nodes
     - kubeconfig             setups the kubeconfig for the local machine
     - list                   lists all created clusters
     - master-ip              get master node ip
     - remove-external-worker remove an external worker from node list

  completion  Generates bash completion scripts

  context     view and manage contexts, include subcommands:
     - add         adds a new context
     - current     prints the current used context
     - delete      deletes a new context
     - list        lists all contexts
     - use         switches to a saved context given by NAME

  help        Help about any command

  ssh-key     view and manage SSH keys, include subcommands:
     - add         adds a new SSH key to the Hetzner Cloud project and local configuration
     - delete      removes a saved SSH key from local configuration and Hetzner Cloud account
     - list        lists all saved SSH keys

  version     prints the current version

Flags:
      --config string   config file to use
  -d, --debug           debug mode
  -h, --help            help for hetzner-kube

Use "hetzner-kube [command] --help" for more information about a command.

And also command are not listed by priority (eg. version, help and completion are less relevant that other commands).

@xetys @JohnnyQQQQ @gadelkareem @voron @pierreozoux @cice @dsteiman @lilvinz @eliasp @Baughn @MartinNowak @zozo @felixonmars @quorak @lfrancke @kabudu @meMo-Minsk @pushthat @jcassee @Zebradil @namxam @eliasp @hojerst @thordin9 @exocode @torgon @EamonKeane @kabudu @rvasilev any opinion? (sorry if I ping you, but as reported above having large feedback should be the first step here :D )

PS: maybe some other DX issue are missing, please report it and I'll update this doc ASAP.

gadelkareem commented 5 years ago

Thanks @mavimo for this proposal. I agree that there is inconsistency with the command structure, but I see this often in packages that are in the early development phases, which should eventually be refactored.

I needed the debug mode to dump a log file so I used the --debug flag in https://github.com/xetys/hetzner-kube/pull/231 but it is still not available for all commands

jcassee commented 5 years ago

@mavimo I'm not a heavy hetzner-kube user, but my $0.02:

All good ideas. The documentation looks helpful.

And also command are not listed by priority (eg. version, help and completion are less relevant that other commands).

Ordering by priority feels like a good idea.

About command consistency, I think many people using hetzner-kube will be familiar with kubctl, so we could take inspiration from it. The command structure is also pretty consistent.

xetys commented 5 years ago

I am totally fine with this proposal. I will add it to our v1.0.0 project.

Zebradil commented 5 years ago

I'm not using the tool currently, so don't take my opinion too seriously, but I completely agree on the first two points:

According the help message. I'd like to see extensive help only if there are only a few options and variations of subcommands. In the other case it makes sense to avoid distraction by hiding help info for subcommands in their own help messages. If I want to see the whole documentation I use man. For me the ideal documentation of command line tool is described as follows:

Zebradil commented 5 years ago

Just to clarify why I prefer alphabetical order instead of priority order.

alphabetical order:

priority order:

mavimo commented 5 years ago

@Zebradil thx for info you share with us; about using man I'm not sure it's the right approach since this is a single executable binary that will be installed via:

wget http://... -o /usr/local/sbin/hetzner-kube
chmod +x /usr/local/sbin/hetzner-kube
/usr/local/sbin/hetzner-kube ...

So there is no setup process as we have via RPM / DEB / Windows Wizard, so I'm not sure have man page should be useful (is not "wrong" but I think is a feature that can be useful as "extra").

About command sorting you're right, is not easy to detect what command should be "on top" but I think some commands as "less useful" (eg help, completion or version, and yes, it's absolutely subjective 😄 ) and can be moved "at the end", but is not easy define order for other commands.

Maybe we can consider to split commands in two "macro section" (operational & utility) and then -for each of this section- add command in alphabetical order?

@jcassee 👍 to use args as kubectl since most of our users will become from this tool, so have the same "approach" I think should be the best approach to give users a good experience.