WIP: fix the command line interface #39

Draft
jlecour wants to merge 2 commits from fix-cli into master
Owner

The main idea is to improve the command line interface by adding new subcommands with much clearer semantics.

For example:

  • bkctld add-ip <JAIL> <IP> : add <IP> to the existing list of ips for <JAIL>
  • bkctld reset-ip <JAIL> <IP> : replace the existing list of ips for <JAIL> with <IP>
  • bkctld list-ips <JAIL> : print the existing list of ips for <JAIL>
  • bkctld add-key <JAIL> <KEY_FILE> : add the key from <KEY_FILE> to the list of authorized keys for <JAIL>
  • bkctld reset-key <JAIL> <KEY_FILE> : replace the list of authorized keys for <JAIL> with the key from <KEY_FILE>
  • bkctld list-keys <JAIL> : print the list of authorized keys for <JAIL>
  • bkctld create-incs : create daily incs
  • bkctld prune-incs : delete incs according to incs policy
  • bkctld list-incs <JAIL> : print the list of incs for <JAIL>
  • bkctld report-incs [all|last] : report incs status
  • bkctld nrpe : NRPE-compatible check (mounted partition, jails last log…)
  • bkctld archive <JAIL> : archive <JAIL>
The main idea is to improve the command line interface by adding new subcommands with much clearer semantics. For example: * `bkctld add-ip <JAIL> <IP>` : add \<IP\> to the existing list of ips for \<JAIL\> * `bkctld reset-ip <JAIL> <IP>` : replace the existing list of ips for \<JAIL\> with \<IP\> * `bkctld list-ips <JAIL>` : print the existing list of ips for \<JAIL\> * `bkctld add-key <JAIL> <KEY_FILE>` : add the key from \<KEY_FILE\> to the list of authorized keys for \<JAIL\> * `bkctld reset-key <JAIL> <KEY_FILE>` : replace the list of authorized keys for \<JAIL\> with the key from \<KEY_FILE\> * `bkctld list-keys <JAIL>` : print the list of authorized keys for \<JAIL\> * `bkctld create-incs` : create daily incs * `bkctld prune-incs` : delete incs according to incs policy * `bkctld list-incs <JAIL>` : print the list of incs for \<JAIL\> * `bkctld report-incs [all|last]` : report incs status * `bkctld nrpe` : NRPE-compatible check (mounted partition, jails last log…) * `bkctld archive <JAIL>` : archive \<JAIL\> * …
jlecour added the
bkctld
label 2020-04-19 11:54:28 +02:00
Owner

I would rather have thought of commands like "command subcommand action", as it is used in many commands : systemctl, rcctl, bgpctl, ospfctl, …

That would give :

  • bkctl ip add / bkctl ip reset / bkctl ip list
  • bkctl key …
  • bkctl incs …

And I don't know if this belongs here, but it would be perfect with auto completion.

I would rather have thought of commands like "command subcommand action", as it is used in many commands : systemctl, rcctl, bgpctl, ospfctl, … That would give : - bkctl ip add / bkctl ip reset / bkctl ip list - bkctl key … - bkctl incs … And I don't know if this belongs here, but it would be perfect with auto completion.
Owner

I agreed with @jdubois here.

I'm also in favor of the command subcommand action pattern here.
Also, maybe use the word replace instead of reset for IP/Key change.

I agreed with @jdubois here. I'm also in favor of the *command subcommand action* pattern here. Also, maybe use the word `replace` instead of `reset` for IP/Key change.
Author
Owner

I really like the pattern bkctld <subcommand> <action> [<option>]. It looks a bit like the "ip" command. But it's a bit more difficult to implement.

If we decide to keep a simpler syntax with just a list of subcommands, we can still compose the subcommand with a prefix and an action, like this :

  • bkctld ip-add <JAIL> <IP> : add <IP> to the existing list of ips for <JAIL>
  • bkctld ip-replace <JAIL> <IP> : replace the existing list of ips for <JAIL> with <IP>
  • bkctld ip-list <JAIL> : print the existing list of ips for <JAIL>
  • bkctld key-add <JAIL> <KEY_FILE> : add the key from <KEY_FILE> to the list of authorized keys for <JAIL>
  • bkctld key-replace <JAIL> <KEY_FILE> : replace the list of authorized keys for <JAIL> with the key from <KEY_FILE>
  • bkctld key-list <JAIL> : print the list of authorized keys for <JAIL>
  • bkctld inc-create : create daily incs
  • bkctld inc-prune : delete incs according to incs policy
  • bkctld inc-list <JAIL> : print the list of incs for <JAIL>
  • bkctld inc-report [all|last|<JAIL>] : report incs status
  • bkctld nrpe : NRPE-compatible check (mounted partition, jails last log…)
  • bkctld archive <JAIL> : archive <JAIL>
I really like the pattern `bkctld <subcommand> <action> [<option>]`. It looks a bit like the "ip" command. But it's a bit more difficult to implement. If we decide to keep a simpler syntax with just a list of subcommands, we can still compose the subcommand with a prefix and an action, like this : * `bkctld ip-add <JAIL> <IP>` : add \<IP\> to the existing list of ips for \<JAIL\> * `bkctld ip-replace <JAIL> <IP>` : replace the existing list of ips for \<JAIL\> with \<IP\> * `bkctld ip-list <JAIL>` : print the existing list of ips for \<JAIL\> * `bkctld key-add <JAIL> <KEY_FILE>` : add the key from \<KEY_FILE\> to the list of authorized keys for \<JAIL\> * `bkctld key-replace <JAIL> <KEY_FILE>` : replace the list of authorized keys for \<JAIL\> with the key from \<KEY_FILE\> * `bkctld key-list <JAIL>` : print the list of authorized keys for \<JAIL\> * `bkctld inc-create` : create daily incs * `bkctld inc-prune` : delete incs according to incs policy * `bkctld inc-list <JAIL>` : print the list of incs for \<JAIL\> * `bkctld inc-report [all|last|<JAIL>]` : report incs status * `bkctld nrpe` : NRPE-compatible check (mounted partition, jails last log…) * `bkctld archive <JAIL>` : archive \<JAIL\> * …
This pull request has changes conflicting with the target branch.
  • README.md
  • bkctld
  • bkctld.8
  • bkctld.conf.5
  • docs/configuration.md
  • docs/incrementals.md
  • docs/install.md
  • docs/usage.md
  • lib/includes
  • test/incs.bats
You can also view command line instructions.

Step 1:

From your project repository, check out a new branch and test the changes.
git checkout -b fix-cli master
git pull origin fix-cli

Step 2:

Merge the changes and update on Forgejo.
git checkout master
git merge --no-ff fix-cli
git push origin master
Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: evolix/evobackup#39
No description provided.