-
Notifications
You must be signed in to change notification settings - Fork 3
Description
The hostmgr command has some lesser-used and setup-related subcommands that are a bit all over the place:
Inconsistencies and spread out commands
hostmgr setand its solehostmgr set automatic-login-passwordsubcommandhostmgr installand its solehostmgr install hostmgr-helpersubcommandhostmgr init, which doesn't even really do what it claims (it creates the directories where the config file should be, but doesn't create a template config file like the command description suggests), and is separate fromhostmgr config(which prints the current configuration)hostmgr syncand its solehostmgr sync authorized-keyssubcommand
Besides, there are some other inconsistencies:
- The struct implementing the
hostmgr generatecommand, and implemented inGenerateCommand.swift, is still namedstruct RunCommandinstead ofstruct 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)…