* 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
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.
* Refactor commands to allow insertion of fakes for testing
* Pin client-go to version that matches signatures other libs use
* Add tests for service list
* actually add test file
* Review comments: Fatal instead of Error/return, Split instead of read to newline
* Get revision and service listing skeletons in.
This adds the kn program, with basic commands for service and revision listing
in.
kn service list
kn revision list
They use the genericclioptions library from kubernetes to support jsonpath,
yaml, and json output. The default is to just list the names of the objects, for
now, until we add in some of the kubectl-based libraries for creating tables in
another commit.
This is deliberately bare-bones; I am looking to get the basic skeletons of how
this repository is laid out down.
No tests yet. Soon.
* Move commands to pkg, so cmd only contains minimalist main.go
* RunE instead of Run. The defaults on Cobra command generation are weird.
* Oops forgot to change types of stuff
* Do not panic on bad config file
* Make commands no longer global
* Make configuration initialization not static in the module, but rather triggered by main.go init