* validate sub command verb (#557)
* fix review comments for pr #555
* validate sub commands
* update error message
* use inner args returned by find func
* return appropriate error message for #557
* return appropriate error message for #557
* Revert "fix review comments for pr #555"
This reverts commit 14ea8d2dc6.
* review comments for pr 589
* misleading error message when verb is bad (#557)
* misleading error message when verb is bad (#557)
* misleading error message when verb is bad (#557)
* Adds zsh completion
- Adds back zsh completion after vendoring cobra library with a fix
- Updates the command definition to accept argument either of ['bash', 'zsh']
- Moves the completion command definition under `pkg/kn/commands/completion`
- Updates docs
- Updates CHANGELOG.adoc
* fix(golint): exported function should have comment
* Fixes PR number in CHANGELOG.adoc
* Updates unit tests
* fix(version): Displays supported APIs and version
Fixes#404
```
./kn version
Version: v20191017-local-6328a73-dirty
Build Date: 2019-10-17 09:55:55
Git Revision: 6328a73
Supported APIs:
- serving.knative.dev/v1alpha1 (knative-serving v0.8.0)
```
* Removes ServingVersion feeding from ldflags
- hardcodes the supported APIs as they're supposed to be updated when we bump deps
* Fixes typo in e2e tests
* Uses array for deterministic order of printing supported APIs
* fix typo (misspell)
* ineffectual assignment to err (ineffassign)
* if block ends with a return statement, so drop this else and outdent its block (golint)
* should replace errors.New(fmt.Sprintf(...)) with fmt.Errorf(...) (golint)
* struct field LogHttp should be LogHTTP (golint)
* fix last typo
* Update serving to 0.8. Try building.
* Find the right serving version
* Change our own import path to knative.dev to match
* Remove dependency on old version of client
* Update yaml template
* Add sleep to test to deal with race
* fix merge conflict
* Update vendor modules
* Allow boolean flags in the matched `--foo` and `--no-foo` format.
* test for it
* Godoc for new functions
* Copyright date update
* Disallow user from setting either flag to false explicitly. Moar tests, for this & other cases
* Apply suggestions from code review
Co-Authored-By: Roland Huß <rhuss@redhat.com>
* Fixup
Fixed:
```
$ ./kn plugin list --lookup-plugins-in-path
panic: runtime error: index out of range
goroutine 1 [running]:
github.com/knative/client/pkg/kn/core.extractKnPluginFlags(0xc00003c0c0, 0x4, 0x4, 0xc0002be280, 0xc000000180, 0xc0002ba180, 0xc0000de670, 0xc000117f68)
/root/go/src/knative.dev/client/pkg/kn/core/root.go:222 +0x666
github.com/knative/client/pkg/kn/core.NewDefaultKnCommand(0xc000000000)
/root/go/src/knative.dev/client/pkg/kn/core/root.go:46 +0x79
main.main()
/root/go/src/knative.dev/client/cmd/kn/main.go:33 +0x46
```
While in there I fixed it so that we only look for --flag at the start
of the arg, and handle the --flag, --flag=, and --flag=xxx cases.
If there's --flagX we skip it because it's some other flag and not one
of interest to us.
Also, fixed some error processing that seemed a bit off.
Signed-off-by: Doug Davis <dug@us.ibm.com>
* Add --log-http option
* Oh yeah build it and change docs and stuff
* And some test
* Actually test the thing I meant to
* There was a way to remove the downcast
* Test for http transport
* Some deps
* Elide sensitive headers from logging
* Test for eliding errors
* Feedback from CL
```bash
➜ client git:(issue309) ✗ ./kn lol
Manage your Knative building blocks:
* Serving: Manage your services and release new software to them.
* Eventing: Manage event subscriptions and channels. Connect up event sources.
Usage:
...
Use "kn [command] --help" for more information about a command.
unknown sub-command or plugin "lol" for "kn"
```
This version contains the following:
1. wraps the main root Kn command to support plugin
2. plugins are any executable in kn's config new pluginDir
variable which defaults to $PATH
3. plugins must have name kn-*
4. 'kn plugin list' sub-command to list found kn plugins
5. skips any kn plugins found with name that match core
commands, e.g., kn-service would be ignored
6. can execute any valid kn plugins found, e.g.,
`kn valid` where the plugin file `kn-valid` is in path
specified in 2.
7. unit tests (using gotest.tools)
And is missing:
1. integration tests
2. plugin install command
3. plugin repository command
4. plugin / Knative server version negotiation
5. anything else we agree on in plugin req doc
I plan to create issues for the things missing so we don't
end up with an even bigger PR. It's already big as is but is a
good MVP as per plugins requirement doc.
* fix(serving): Remove hardcoded GVK and look it up from schema
Fixes#133.
* chore(serving): Add test for "WaitForService()"
* refactor(service): Add listRoutes() to client + generic way for list options
* chore(serving): Fixing rebase conflicts
Explores all sub-commands from root and adds a RunE for all
commands that are groups with child commands and without a RunE.
The added RunE will return the correct errors when the command
is called with empty sub-command or with an unknown sub-command.
It will also print the command help message first.
Added a gotest.tools test for root.go.
- Accepts an argument name for listing particular route
- Enables the machine readable output flags
- Updates docs for kn route command group
- Adds unit tests for route command group and route list
- Adds integration tests for route list in basic workflow test
- Updates tests and getting namespace
- Adds more unit tests for code in pkg/kn/commands/route/list_flags.go
- Adds route list command in smoke tests
- Updates vendor/modules.txt
- Clean up imports
- Addresses review comments
- replaces knative to Knative
- uses reflect.DeepEqual for slice comparison
- removes few code comments
- removes irrelevant tests modifications from the PR
* Set current namespace from kubeconfig by default
Currently kn command does not pick up namespace from kubeconfig but
hardcorded default namespace.
This patch fixes to get namespace from kubeconfig.
Fixes https://github.com/knative/client/issues/7
* Use NamespaceFactory to get current namespace
* Update unit tests
* Add nil check for ClientConfig
* Remove unused `--config` option
Currently `--config` option in kn command is not used from anywhere.
This patch removes the option from the command.
* update auto gen files
* Update deps by hack/update-deps.sh
Creates four subpackages for now:
1. kn/commands - inludes types.go for common
struct and other common files and misc commands
2. kn/commands/service - all 'kn service *' commands
3. kn/commands/revision - all 'kn revision *' commands
4. kn/core - contains the root.go and other top level
for code and testing
5. refactors:
a. split .../commons/human_readable_flags.go into three
b. modifies the HumanReadableFlags.ToPrinter to get pass
a function that sets the columns and fields
Had to refactor all tests to avoid cycles.