Closed guumaster closed 4 years ago
remove domains
and set domains
commands-p, --profile
flag value (i.e., profile available in user hosts). A common use-case is to add a command like:
hostctl init --shell [bash | zsh | fish | ...]
This command can be eval from the user shell dotfile and output the completion for the selected shell.
To have the profile / domains completion, a --batch
flag to the list
command can list available values:
# hostctl list --batch --column profile
default
site1
site2
# hostctl list --batch --column ip
192.168.10.10
192.168.10.11
I like that about autocomplete and show columns.
Not sure I understand the --batch
flag
Like mysql:
--batch, -B Print results using tab as the column separator, with each row on a new line
It would be used to remove the decoration of the output.
# mysql -e 'show processlist;'
+--------+------------------+-----------------+-------------------+--------------+------+-----------------------------------------------------------------------------+------------------+-------+
| 920843 | system user | | NULL | Slave_SQL | 4483 | Slave has read all relay log; waiting for the slave I/O thread to update it | NULL | 0.000 |
| 921883 | root | localhost | NULL | Query | 0 | init | show processlist | 0.000 |
+--------+------------------+-----------------+-------------------+--------------+------+-----------------------------------------------------------------------------+------------------+-------+
# mysql --batch -e 'show processlist;'
920843 system user NULL Slave_SQL 4494 Slave has read all relay log; waiting for the slave I/O thread to update it NULL 0.000
921884 root localhost NULL Query 0 init show processlist 0.000
Oh I see, I'm not sure if batch
is the best name, but the feature may be useful.
I think we can do two things for this, one is a flag like --output clean
(as opposed to the table
default) and then a preference file (like $HOME/.hostctl/config`) where you can set different defaults options.
I think we can do two things for this, one is a flag like --output clean
or --output raw
The use case for the output without a table decoration is:
So I don't know if a preference in a config file is needed for that.
Cobra seem to provide ressources to generate completion, there is some documentation available here: https://github.com/spf13/cobra/blob/master/bash_completions.md
@BarbUk I've implemented --raw
output and --column
selection, but after reading the guides on autocompletion for cobra
I cannot make it work. If you want to give it a try, there is an open branch/PR #28 that you can start from
Moving this list to #45
Thinks I'd like to add:
hostctl sync k8s -n namespace -p profile
hostctl sync minikube -p profile
hostctl sync docker -p profile
hostctl sync docker-compose -f docker-compose.yml -p profile
Also with a
--watch
flag to monitor and react to changes