Skip to content

Cleanup hostmgr various setup root commands #108

@AliSoftware

Description

@AliSoftware

The hostmgr command has some lesser-used and setup-related subcommands that are a bit all over the place:

Inconsistencies and spread out commands

Besides, there are some other inconsistencies:

  • The struct implementing the hostmgr generate command, and implemented in GenerateCommand.swift, is still named struct RunCommand instead of struct GenerateCommand

Proposed Solutions

The idea would be to move all the above commands as subcommands of a single root command, instead of having them spread out each as their own command with a single subcommand.

Proposal 1️⃣ : Move everything under hostmgr config

Old New
hostmgr set automatic-login-password hostmgr config set-automatic-login-password
hostmgr install hostmgr-helper hostmgr config install-helper
hostmgr init hostmgr config init
hostmgr config hostmgr config show
hostmgr sync authorized-keys hostmgr config sync-authorized-keys

The only thing that could feel odd with this is that set-automatic-login-password / install-helper and sync-authorized-keys are not really related to "the config file", so while the name hostmgr config for that command could still work when interpreted as "configure hostmgr to make it work", this still feels a bit odd

Proposal 2️⃣ : Move everything under hostmgr setup

Old New
hostmgr set automatic-login-password hostmgr setup automatic-login-password
hostmgr install hostmgr-helper hostmgr setup install-helper
hostmgr init hostmgr setup init-config
hostmgr config hostmgr setup show-config
hostmgr sync authorized-keys hostmgr setup sync-authorized-keys

Though it has the opposite odd feeling as 1‍⃣ , where hostmgr setup makes sense for most of the commands but might feel odd to be used for manipulating the config file. Though imho this at least feels a bit less odd than 1‍⃣ ? 🤷

Proposal 3‍⃣ : Split into hostmgr config and hostmgr setup

Old New
hostmgr set automatic-login-password hostmgr setup automatic-login-password
hostmgr install hostmgr-helper hostmgr setup install-helper
hostmgr init hostmgr config init
hostmgr config hostmgr config
hostmgr sync authorized-keys hostmgr setup sync-authorized-keys

Means we'd still keep those commands spread in 2 subcommands instead of one, so they'd still be a bit spread out as they current are, but quite less so at least (i.e. in 2 subcommands rather than 5).
This has the benefit of getting rid of the odd feelings mentioned in 1‍⃣ and 2‍⃣ though with the commands about config file still being separated from the setup ones (but the init of the config file now being properly grouped with the one showing the content)…

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions