Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New features #22

Closed
2 of 4 tasks
guumaster opened this issue Mar 31, 2020 · 7 comments
Closed
2 of 4 tasks

New features #22

guumaster opened this issue Mar 31, 2020 · 7 comments
Labels
feature New feature or request

Comments

@guumaster
Copy link
Owner

guumaster commented Mar 31, 2020

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

@guumaster guumaster added the feature New feature or request label Mar 31, 2020
@BarbUk
Copy link
Contributor

BarbUk commented Apr 1, 2020

  • shell completion for available flag / command
  • shell completion for available domains for remove domains and set domains commands
  • shell completion for -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

@guumaster
Copy link
Owner Author

I like that about autocomplete and show columns.

Not sure I understand the --batch flag

@BarbUk
Copy link
Contributor

BarbUk commented Apr 1, 2020

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

@guumaster
Copy link
Owner Author

guumaster commented Apr 1, 2020

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.

@BarbUk
Copy link
Contributor

BarbUk commented Apr 1, 2020

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:

  • use it for completion
  • use it to pipe in other unix tool (awk / grep / less ...)

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

@guumaster
Copy link
Owner Author

@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

@guumaster
Copy link
Owner Author

Moving this list to #45

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants