Skip to content

Carry 13934: Add docker daemon to bash completion#15166

Merged
calavera merged 1 commit intomoby:masterfrom
tiborvass:carry-13934
Jul 30, 2015
Merged

Carry 13934: Add docker daemon to bash completion#15166
calavera merged 1 commit intomoby:masterfrom
tiborvass:carry-13934

Conversation

@tiborvass
Copy link
Copy Markdown
Contributor

Signed-off-by: Harald Albers github@albersweb.de
Signed-off-by: Tibor Vass tibor@docker.com

Closes #13934

Ping @tianon I have no idea if this is good or lacking.

Signed-off-by: Harald Albers <github@albersweb.de>
Signed-off-by: Tibor Vass <tibor@docker.com>
@tianon
Copy link
Copy Markdown
Member

tianon commented Jul 30, 2015

LGTM

@calavera
Copy link
Copy Markdown
Contributor

LGTM

calavera added a commit that referenced this pull request Jul 30, 2015
Carry 13934: Add `docker daemon` to bash completion
@calavera calavera merged commit 868f85b into moby:master Jul 30, 2015
@calavera
Copy link
Copy Markdown
Contributor

cherry picked into #15091

@albers
Copy link
Copy Markdown
Member

albers commented Jul 31, 2015

Back from holiday, so here is my review:

There is a group of options that is both contained in the output of docker --help and docker daemon help:

-D, --debug=false                    Enable debug mode
-H, --host=[]                        Daemon socket(s) to connect to
-l, --log-level=info                 Set the logging level
--tls=false                          Use TLS; implied by --tlsverify
--tlscacert=~/.docker/ca.pem         Trust certs signed only by this CA
--tlscert=~/.docker/cert.pem         Path to TLS certificate file
--tlskey=~/.docker/key.pem           Path to TLS key file
--tlsverify=false                    Use TLS and verify the remote

Are these options really supported in both positions? That means they could be legally specified twice, e.g.

docker -l info daemon -l debug

Completion only supports these options for docker, not docker daemon.
If the options are legal in both positions, I will add them.

cc @thaJeztah

@tiborvass
Copy link
Copy Markdown
Contributor Author

@albers they are not legal, it will error out.

@tiborvass
Copy link
Copy Markdown
Contributor Author

@albers as in, docker --tls run ... is legal, docker daemon --tls is legal, but docker --tls daemon --tls is not. I just don't know how to describe that.

EDIT: also, there is no way you can prevent the user from this: if it autocompletes to use --tls after docker, then it would be confusing to disallow daemon, they'd be like "wait why is there no daemon command" ? I'd much rather let them do docker --tls daemon --tls and learn that it's incorrect.

@albers
Copy link
Copy Markdown
Member

albers commented Jul 31, 2015

@tiborvass I see. So the new syntax would be docker daemon --tls and docker --tls is just for compatibility. As far as there is no conflict, the latter syntax works.

@tiborvass
Copy link
Copy Markdown
Contributor Author

@albers Well, docker --tls is not for backwards compat (we don't want backwards compat in a bash completion script), it's for docker client commands (all except daemon).

@albers
Copy link
Copy Markdown
Member

albers commented Jul 31, 2015

@tiborvass I thing I got it: The above mentioned options are valid for all client commands as global options, i.e. they must be given right behind docker, e.g. docker --log-level debug run.

For docker daemon, these options are command options, i.e. they have to follow the command, e.g. docker daemon --log-level debug. For this one command, the global syntax is invalid and errors out. Example: docker --log-level debug daemon is invalid.

@tiborvass
Copy link
Copy Markdown
Contributor Author

@albers correct

@albers
Copy link
Copy Markdown
Member

albers commented Jul 31, 2015

@tiborvass Thanks for your patience. I'm a bit in a hurry to finish up the completion.

So I will add support for the global options to docker daemon as command options as they are currently missing there.

@tiborvass
Copy link
Copy Markdown
Contributor Author

@albers okay sorry about that, I'm really not good at these completion scripts. Thanks for your help!

@albers
Copy link
Copy Markdown
Member

albers commented Jul 31, 2015

@tiborvass Well, I'm sorry that completion bounced back to you because I was on holiday. Thanks for taking care of it!

@albers
Copy link
Copy Markdown
Member

albers commented Jul 31, 2015

@tiborvass By the way, I found that docker --log-level debug daemon errors out with

invalid flag '-l'.

Is this framework related or can this be fixed?

@thaJeztah
Copy link
Copy Markdown
Member

I'm sorry that completion bounced back to you because I was on holiday. Thanks for taking care of it!

@albers please don't feel sorry. We were aware you didn't have time, and you're always helping out in fantastic ways. There's more in life than Docker and you deserve your Holidays, no stress (really!) ❤️

@tiborvass tiborvass deleted the carry-13934 branch July 17, 2019 00:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants