Hide command options that are related to Windows#30788
Hide command options that are related to Windows#30788vdemeester merged 1 commit intomoby:masterfrom boaz0:hide_win_opts
Conversation
|
//cc @albers @thaJeztah @dnephin |
cli/command/image/build.go
Outdated
There was a problem hiding this comment.
--squash is not windows only, I think it was just being used as an example of an experimental flag.
cli/command/stack/opts.go
Outdated
There was a problem hiding this comment.
rather linux only at the moment 😅
client/ping.go
Outdated
There was a problem hiding this comment.
This seems kind of hacky, I can see this failing unexpectedly.
I think it would be better to add a new header with the serverOS in a format that is easier to parse (or doesn't need to be parsed at all).
cmd/docker/docker.go
Outdated
There was a problem hiding this comment.
We use this Option naming convention for data objects populated from command line flags. This struct is not being used that way, so I think the name is confusing.
How about apiProperties or apiFeatures or something like that?
cmd/docker/docker.go
Outdated
There was a problem hiding this comment.
There's an extra blank line above "strings".
There was a problem hiding this comment.
Yes, I know. vim-go does that automatically. I can fix that, though.
EDIT to avoid overloading the Jenkins master I will push this change only if there will be at least one more comment about the design.
Thanks.
|
Looking at the output of the I wonder if we should use the same terminology ( |
|
@thaJeztah sounds right. I know |
cmd/docker/docker.go
Outdated
There was a problem hiding this comment.
Can you include this in the isFlagSupported() function? e.g.
if !isFlagSupported(f, apiProps.OSType, apiProps.ClientVer) {
f.Hidden = true
}There was a problem hiding this comment.
This logic should take older daemons into account; older daemons won't return an OS-Type header. As a result, this logic will hide any flag that has a os annotation set. If the daemon didn't return an OS-Type header, just show the flag.
There was a problem hiding this comment.
Sure, I am surprised I missed it. Thanks for noticing me!
cli/command/container/opts.go
Outdated
There was a problem hiding this comment.
nit: Should we name this "ostype" / "os-type" as well to be consistent (otherwise there's a risk they're getting different meanings)?
cmd/docker/docker.go
Outdated
There was a problem hiding this comment.
nit; using an or here is probably clearer;
if !isOSTypeSupported(f, osType) || !isVersionSupported(f, clientVersion) {
f.Hidden = true
}
thaJeztah
left a comment
There was a problem hiding this comment.
LGTM, thank you!
As a follow-up we may want to look into hiding Linux flags on Windows. Especially on docker run there's a lot of flags that are Linux-specific, and I think it'll be a nice enhancements to hide those when running against a Windows daemon 👍
|
@thaJeztah sure thing! |
|
ping @dnephin ptal @ripcurld0 heard you're a git rebase pro 😉 |
|
indeed, i am 🥇 |
Signed-off-by: Boaz Shuster <ripcurld.github@gmail.com>
| // OSType returns the operating system the daemon is running on. | ||
| func (cli *DockerCli) OSType() string { | ||
| return cli.osType | ||
| } |
There was a problem hiding this comment.
I'm now realizing that we never should have put these things on DockerCli directly. We should have created a new struct to store experimental and default version. That would make the signature for isSupported() and the others a lot cleaner.
I'll handle that in a new PR.
Hide command options that are related to Windows
- What I did
On Linux hide commands options that are relevant to Windows.
- How I did it
osannotation containing the operating system name- How to verify it
🤔