Commit Graph

16 Commits

Author SHA1 Message Date
Brian Goff 5400a48aaf
Plumb contexts through commands
This is to prepare for otel support.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-12-12 22:30:16 +01:00
Sebastiaan van Stijn 8e9aec6904
golangci-lint: revive: enable import-shadowing
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-11-20 19:52:41 +01:00
Nicolas De Loof cbec75e2f3
Adopt Cobra completion v2 to support completion by CLI plugins
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-05-12 12:59:10 +02:00
Vincent Demeester 55edeb497a
Migrate to non-deprecated functions of `api/types/filters`
- Use `Contains` instead of `Include`
- Use `ToJSON` instead of `ToParam`
- Remove usage of `ParseFlag` as it is deprecated too

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2018-07-27 15:37:43 +02:00
Kir Kolyshkin 6f8070deb2 Switch from x/net/context to context
Since go 1.7, "context" is a standard package. Since go 1.9,
x/net/context merely provides some types aliased to those in
the standard context package.

The changes were performed by the following script:

for f in $(git ls-files \*.go | grep -v ^vendor/); do
	sed -i 's|golang.org/x/net/context|context|' $f
	goimports -w $f
	for i in 1 2; do
		awk '/^$/ {e=1; next;}
			/\t"context"$/ {e=0;}
			{if (e) {print ""; e=0}; print;}' < $f > $f.new && \
				mv $f.new $f
		goimports -w $f
	done
done

[v2: do awk/goimports fixup twice]
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-05-11 16:49:43 -07:00
Sebastiaan van Stijn c5f267d95c
Do not truncate ID on docker service ps --quiet
Running `docker service ps --quiet` should print the
full, non-truncated ID, even if the `--no-trunc` option
is not set.

This patch disables truncation if the `--quiet` flag
is set.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-09-30 22:23:37 +02:00
Daniel Nephin e7f90b6b38 Reduce complexity in cli/command/container
Add tests for exec and cleanup existing tests.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-08-29 19:25:50 -04:00
Daniel Nephin 0030bfea9f Remove duplication in task formatting.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-07-05 13:40:47 -04:00
Daniel Nephin b5baffde44 Fix complexity of service/ps.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-06-01 11:49:16 -04:00
Sebastiaan van Stijn 6279612443
Fix prefix-matching for service ps
The docker CLI matches objects either by ID _prefix_
or a full name match, but not partial name matches.

The correct order of resolution is;

- Full ID match (a name should not be able to mask an ID)
- Full name
- ID-prefix

This patch changes the way services are matched.

Also change to use the first matching service, if there's a
full match (by ID or Name) instead of continue looking for
other possible matches.

Error handling changed;

- Do not error early if multiple services were requested
  and one or more services were not found. Print the
  services that were not found after printing those that
  _were_ found instead
- Print an error if ID-prefix matching is ambiguous

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-05-31 21:43:56 +02:00
Vincent Demeester d7f6563efc
Update cli imports to using local package
Also, rename a bunch of variable to not *shadow* the `opts` package
name.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2017-05-15 14:45:19 +02:00
Daniel Nephin 37ccc00d0e Add interfacer linter
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-05-08 15:57:50 -04:00
Daniel Nephin 690ef8af79 Enable golint
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-05-02 17:57:46 -04:00
Gaetan de Villele 5aa70d68b3 remove service runtime filter from client
it’s moving to the server.

Signed-off-by: Gaetan de Villele <gdevillele@gmail.com>
2017-04-27 15:07:20 -07:00
Daniel Nephin 10641c2aae Update imports.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-04-17 18:07:56 -04:00
Daniel Nephin 1630fc40f8 Import docker/docker/cli
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2017-04-17 17:40:59 -04:00