Commit graph

35 commits

Author SHA1 Message Date
Sebastiaan van Stijn
45920009cc Don't automagically add "[OPTIONS]" to usage
This removes the logic to automatically
add [OPTIONS] to the usage output.

The current logic was broken if a command
only has deprecated or hidden flags, and
in many cases put the [OPTIONS] in the
wrong location.

Requiring the usage string to be set
manually gives more predictable results,
and shouldn't require much to maintain.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 4f0b510552)
Signed-off-by: Tibor Vass <tibor@docker.com>
2016-07-25 23:15:41 -07:00
allencloud
acc31b4448 fix comments and handle err
Signed-off-by: allencloud <allen.sun@daocloud.io>
(cherry picked from commit cc054f3195)
2016-06-30 17:12:45 -07:00
Daniel Nephin
12a00e6017 Add Swarm management CLI commands
As described in our ROADMAP.md, introduce new Swarm management commands
to call to the corresponding API endpoints.

This PR is fully backward compatible (joining a Swarm is an optional
feature of the Engine, and existing commands are not impacted).

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Signed-off-by: Victor Vieux <vieux@docker.com>
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2016-06-13 22:17:15 -07:00
Daniel Nephin
6bc3e23f65 Refactor cli inspector to support new inspects.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-05-31 14:41:37 -07:00
Vincent Demeester
4c7f0d268f
Rework usage of context.Context in api/client
Make better default usage on context.Context on the `api/client` package
to share the context (it is useless if not shared, which was the case
for a lot of commands).

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2016-05-21 15:57:57 +02:00
Vincent Demeester
8567286ed6 Update api/client file to use context
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2016-03-16 20:25:09 +01:00
David Calavera
8514880997 Provide basic string manupilation functions for template executions.
This change centralizes the template manipulation in a single package
and adds basic string functions to their execution.

Signed-off-by: David Calavera <david.calavera@gmail.com>
2016-03-09 19:37:12 -05:00
David Calavera
907407d0b2 Modify import paths to point to the new engine-api package.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2016-01-06 19:48:59 -05:00
David Calavera
57b6796304 Implement all inspect commands with the new inspector interface.
It makes the behavior completely consistent across commands.
It adds tests to check that execution stops when an element is not
found.

Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-12-09 12:05:01 -05:00
David Calavera
cf3efd05d4 Implement docker inspect with standalone client lib.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-12-09 12:05:00 -05:00
Shuwei Hao
e719c9225c Modufy docker inspect client to check statusCode instead of strings contains
Signed-off-by: Shuwei Hao <haosw@cn.ibm.com>
2015-12-07 10:03:46 +00:00
Antonio Murdaca
7929888214 Remove deprecated cli flags
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2015-11-15 10:40:01 +01:00
Brian Goff
72aeb63a47 Reutrn immediately when inspect connection failed
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2015-11-04 21:17:05 -05:00
David Calavera
3b9c13873a Fail when there is an error executing an inspect template.
- Do not execute the template directly in the cli outout, go is not atomic
in this operation and can send bytes before failing the execution.
- Fail after evaluating a raw interface if the typed execution also
failed, assuming there is a template parsing error.

Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-10-22 19:24:50 -04:00
Zhang Kun
b4d6b23838 add size to inspect
Signed-off-by: Zhang Kun <zkazure@gmail.com>
2015-10-10 20:44:29 +08:00
Lei Jitang
2b0927c9ac Use consistent command description
Signed-off-by: Lei Jitang <leijitang@huawei.com>
2015-10-08 08:46:21 -04:00
Tibor Vass
96ce3a194a cli: new daemon command and new cli package
This patch creates a new cli package that allows to combine both client
and daemon commands (there is only one daemon command: docker daemon).

The `-d` and `--daemon` top-level flags are deprecated and a special
message is added to prompt the user to use `docker daemon`.

Providing top-level daemon-specific flags for client commands result
in an error message prompting the user to use `docker daemon`.

This patch does not break any old but correct usages.

This also makes `-d` and `--daemon` flags, as well as the `daemon`
command illegal in client-only binaries.

Signed-off-by: Tibor Vass <tibor@docker.com>
2015-07-23 19:44:46 -04:00
Ma Shimiao
9a4cbb358d api/client: unify format of args check
Signed-off-by: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com>
2015-07-08 17:29:47 +08:00
Shishir Mahajan
2cb74e6915 Flag Addition: --type flag added for docker inspect command
Signed-off-by: Shishir Mahajan <shishir.mahajan@redhat.com>
2015-07-01 12:14:01 -04:00
Josh Hawn
4cb0c93f92 api/client: Allow for multi-line usage help
Subcommands can provide multiple usage synopses.

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
2015-06-10 16:14:45 -07:00
Qiang Huang
01a9a9284f Add comment about inspect output
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2015-06-03 17:35:57 +08:00
Victor Vieux
52c3bb6a0e fallback to interface with docker inspect
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
2015-05-11 17:39:21 -07:00
Qiang Huang
5a6db4fd44 a few cleanups for client output
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2015-05-05 15:59:17 +08:00
Doug Davis
15313dfdf3 Merge pull request #12735 from jmzwcn/patch-1
Remove empty line after client.CmdInspect docstring
2015-05-03 11:10:14 -04:00
jmzwcn
28547a1a3a Remove empty line after client.CmdInspect docstring #12706
Signed-off-by: Daniel Zhang <jmzwcn@gmail.com>

Remove empty line after client.CmdInspect docstring

fix #12706
Signed-off-by: Daniel Zhang <jmzwcn@gmail.com>

Remove empty line after client.CmdInspect docstring

fix #12706
Signed-off-by: Daniel Zhang <jmzwcn@gmail.com>
2015-05-03 17:23:18 +08:00
Qiang Huang
c7812f01c7 fix a minor inspect format issue
Before, inspect cont1 cont2 shows:
[{
    xxx
}
,{
    xxx
}
]
After, it shows:
[
{
   xxx
}
,{
    xxx
}
]

Because `func (*Encoder) Encode` always followed by a newline character,
so it's difficult to put '}' and ']' one the same line.

To get symmetry, above is our choice.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2015-04-28 18:51:04 +08:00
Srini Brahmaroutu
231d362db7 Allow go template to work properly with inspect
Closes #11641

Signed-off-by: Srini Brahmaroutu <srbrahma@us.ibm.com>
2015-04-23 18:25:18 +00:00
Qiang Huang
b0ef3194aa fix inspect format result
Currently `docker inspect -f` use json.Unmarshal() unmarshal
to interface, it will store all JSON numbers in float64, so
we use `docker inspect 4f0d73b75a0d | grep Memory` and
`docker inspect -f {{.HostConfig.Memory}} 4f0d73b75a0d` will
get different values.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2015-04-23 09:28:07 +08:00
Deshi Xiao
bae3023eef client.StatusError don't be returned as a pointer
closes #12373

1. remove & from client.StatusError
2. remove * from Error method

Signed-off-by: Deshi Xiao <xiaods@gmail.com>
2015-04-16 01:27:07 +08:00
Antonio Murdaca
c30a55f14d Refactor utils/utils, fixes #11923
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
2015-04-14 01:37:36 +02:00
Doug Davis
d351aef8af Remove dead code looking for non-existent err msg
Closes #11985

Signed-off-by: Doug Davis <dug@us.ibm.com>
2015-04-01 07:37:10 -07:00
Antonio Murdaca
5670c6c695 Refactor utils/flags.go, fixes #11892
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
2015-03-29 03:22:46 +02:00
Don Kjer
6b2eeaf896 Fix for issue 9922: private registry search with auth returns 401
Signed-off-by: Don Kjer <don.kjer@gmail.com>
2015-03-26 18:59:16 +00:00
Peggy Li
b5d0380108 Add godoc-style docstrings to Cmd... methods
Signed-off-by: Peggy Li <peggyli.224@gmail.com>
2015-03-25 14:17:11 -07:00
Joey Gibson
58690c9cca api/client - The code for all cli commands are in one file #11610
Signed-off-by: Joey Gibson <joey@joeygibson.com>
2015-03-24 23:57:23 -04:00