Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Kn plugins implementation #177

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
10 changes: 5 additions & 5 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Development

This doc explains how to setup a development environment so you can get started
This doc explains how to set up a development environment so you can get started
[contributing](https://www.knative.dev/contributing/) to `Knative Client`.
Also take a look at:

Expand All @@ -16,7 +16,7 @@ Before submitting a PR, see also [contribution guide](https://www.knative.dev/co

### Sign up for GitHub

Start by creating [a GitHub account](https://github.com/join), then setup
Start by creating [a GitHub account](https://github.com/join), then set up
[GitHub access via SSH](https://help.github.com/articles/connecting-to-github-with-ssh/).

### Install requirements
Expand All @@ -31,7 +31,7 @@ You must install these tools:

### Create a cluster

1. [Set up a Knative](https://www.knative.dev/docs/install/), You can also setup using limited install guides like [Minikube](https://knative.dev/docs/install/knative-with-minikube/) or [Minishift](https://knative.dev/docs/install/knative-with-minishift/).
1. [Set up a Knative](https://www.knative.dev/docs/install/), You can also set up using limited install guides like [Minikube](https://knative.dev/docs/install/knative-with-minikube/) or [Minishift](https://knative.dev/docs/install/knative-with-minishift/).

### Checkout your fork

Expand All @@ -55,7 +55,7 @@ described below.

## Building Knative Client

Once you've [setup your development environment](#prerequisites), let's build
Once you've [set up your development environment](#prerequisites), let's build
`Knative Client`.

**Dependencies:**
Expand All @@ -79,7 +79,7 @@ You can link that script into a directory within your search `$PATH`. This allow

See `build.sh --help` for a full list of options and usage examples.

At the end, the build results in `kn` binary in your current directory, which can be directly executed.
In the end, the build results in `kn` binary in your current directory, which can be directly executed.

**Notes:**

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Goals:

# Docs

Start with the [user's guide](docs/README.md) and from there you can can read about common use cases, get detail docs on each command, and even how to extend the `kn` CLI. Links below for easy access.
Start with the [user's guide](docs/README.md) and from there you can read about common use cases, get detail docs on each command, and even how to extend the `kn` CLI. Links below for easy access.

* [User's guide](docs/README.md)
* [Basic workflows](docs/workflows.md) (use cases)
Expand Down
8 changes: 7 additions & 1 deletion cmd/kn/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,22 @@ import (
"os"

"github.com/knative/client/pkg/kn/core"
"github.com/spf13/viper"
)

func init() {
core.InitializeConfig()
}

func main() {
err := core.NewKnCommand().Execute()
defer cleanup()
err := core.NewDefaultKnCommand().Execute()
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}

func cleanup() {
viper.WriteConfig()
}
16 changes: 8 additions & 8 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# kn

`kn` is the Knative command line interface (CLI).
`kn` is the Knative command line interface (CLI).

## Getting Started

### Installing `kn`

You can grab the latest nightly binary executable for:
* [Max OS X](https://storage.cloud.google.com/knative-nightly/client/latest/kn-darwin-amd64)
* [Linix AMD 64](https://storage.googleapis.com/knative-nightly/client/latest/kn-linux-amd64)
* [Linux AMD 64](https://storage.googleapis.com/knative-nightly/client/latest/kn-linux-amd64)
* [Windows AMD 64](https://storage.googleapis.com/knative-nightly/client/latest/kn-windows-amd64.exe)

Put it on your system path, and make sure it's executable.
Expand Down Expand Up @@ -41,7 +41,7 @@ See the [generated documentation.](cmd/kn.md)

A Knative service is the embodiment of a serverless workload. Generally in the form of a collection of containers running in a group of pods in the underlying Kubernetes cluster. Each Knative service associates with a collection of revisions which represents the evolution of that service.

With the Kn CLI a user can list/[`get`](cmd/kn_service_get.md), [`create`](cmd/kn_service_create.md), [`delete`](cmd/kn_service_delete.md), and [`update`](cmd/kn_service_update.md) Knative services. The [detail reference](cmd/kn_service.md) of each sub-command under the [`service` command](cmd/kn_service.md) shows the options and flags for this group of commands.
With the Kn CLI a user can [`list`](cmd/kn_service_list.md), [`create`](cmd/kn_service_create.md), [`delete`](cmd/kn_service_delete.md), and [`update`](cmd/kn_service_update.md) Knative services. The [detail reference](cmd/kn_service.md) of each sub-command under the [`service` command](cmd/kn_service.md) shows the options and flags for this group of commands.

Examples:

Expand All @@ -56,23 +56,23 @@ You are able to also specify the requests and limits of both CPU and memory when
```bash
# List existing services in the 'default' namespace of your cluster

kn service get
kn service list
```

You can also list services from all namespaces or specific namespace using flags: `--all-namespaces` and `--namespace mynamespace`. See [`service get` command](cmd/kn_service_get.md) reference for additional details.
You can also list services from all namespaces or specific namespace using flags: `--all-namespaces` and `--namespace mynamespace`. See [`service list` command](cmd/kn_service_list.md) reference for additional details.

### Revision Management

A Knative revision is a "snapshot" of the specification of a service. For instance, when a Knative service is created with environment variable `FOO=bar` a revision is added to the service. When later the environment variable is changed to `baz` or additional variables are added, a new revision is created. When the image the service is running is changed to a new digest, a new revision is created.
A Knative revision is a "snapshot" of the specification of a service. For instance, when a Knative service is created with environment variable `FOO=bar` a revision is added to the service. When later the environment variable is changed to `baz` or additional variables are added, a new revision is created. When the image the service is running is changed to a new digest, a new revision is created.

With the [`revision` command group](cmd/kn_revision.md) you can list/[get](cmd/kn_revision_get.md) and [describe](cmd/kn_revision_describe.md) the current revisions on a service.
With the [`revision` command group](cmd/kn_revision.md) you can [list](cmd/kn_revision_list.md) and [describe](cmd/kn_revision_describe.md) the current revisions on a service.

Examples:

```bash
# Listing a service's revision

kn revision get --service srvc # CHECK this since current command does not have --service flag
kn revision list --service srvc # CHECK this since current command does not have --service flag
```

### Utilities
Expand Down
3 changes: 3 additions & 0 deletions docs/cmd/kn.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,16 @@ Eventing: Manage event subscriptions and channels. Connect up event sources.
### Options

```
--config string config file (default is $HOME/.kn/config.yaml)
-h, --help help for kn
--kubeconfig string kubectl config file (default is $HOME/.kube/config)
--plugin-dir string kn plugin directory (default is value in kn config or $PATH)
```

### SEE ALSO

* [kn completion](kn_completion.md) - Output shell completion code (default Bash)
* [kn plugin](kn_plugin.md) - Plugin command group
* [kn revision](kn_revision.md) - Revision command group
* [kn service](kn_service.md) - Service command group
* [kn version](kn_version.md) - Prints the client version
Expand Down
2 changes: 2 additions & 0 deletions docs/cmd/kn_completion.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ kn completion [flags]
### Options inherited from parent commands

```
--config string config file (default is $HOME/.kn/config.yaml)
--kubeconfig string kubectl config file (default is $HOME/.kube/config)
--plugin-dir string kn plugin directory (default is value in kn config or $PATH)
```

### SEE ALSO
Expand Down
34 changes: 34 additions & 0 deletions docs/cmd/kn_plugin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
## kn plugin

Plugin command group

### Synopsis

Provides utilities for interacting with kn plugins.

Plugins provide extended functionality that is not part of the major command-line distribution.
Please refer to the documentation and examples for more information about how write your own plugins.

```
kn plugin [flags]
```

### Options

```
-h, --help help for plugin
```

### Options inherited from parent commands

```
--config string config file (default is $HOME/.kn/config.yaml)
--kubeconfig string kubectl config file (default is $HOME/.kube/config)
--plugin-dir string kn plugin directory (default is value in kn config or $PATH)
```

### SEE ALSO

* [kn](kn.md) - Knative client
* [kn plugin list](kn_plugin_list.md) - List all visible plugin executables on a user's PATH

36 changes: 36 additions & 0 deletions docs/cmd/kn_plugin_list.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
## kn plugin list

List all visible plugin executables on a user's PATH

### Synopsis

List all visible plugin executables on a user's PATH.

Available plugin files are those that are:
- executable
- anywhere on the user's PATH
maximilien marked this conversation as resolved.
Show resolved Hide resolved
- begin with "kn-

```
kn plugin list [flags]
```

### Options

```
-h, --help help for list
--name-only If true, display only the binary name of each plugin, rather than its full path
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be reversed. In most cases I don't think people will care where the exe lives and when they do care it's probably because they're debugging to see why things are not acting correctly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, up for debate. Especially if we decide to have a fix location.

```

### Options inherited from parent commands

```
--config string config file (default is $HOME/.kn/config.yaml)
--kubeconfig string kubectl config file (default is $HOME/.kube/config)
--plugin-dir string kn plugin directory (default is value in kn config or $PATH)
```

### SEE ALSO

* [kn plugin](kn_plugin.md) - Plugin command group

4 changes: 3 additions & 1 deletion docs/cmd/kn_revision.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ Revision command group
### Options inherited from parent commands

```
--config string config file (default is $HOME/.kn/config.yaml)
--kubeconfig string kubectl config file (default is $HOME/.kube/config)
--plugin-dir string kn plugin directory (default is value in kn config or $PATH)
```

### SEE ALSO

* [kn](kn.md) - Knative client
* [kn revision describe](kn_revision_describe.md) - Describe revisions.
* [kn revision get](kn_revision_get.md) - Get available revisions.
* [kn revision list](kn_revision_list.md) - List available revisions.

2 changes: 2 additions & 0 deletions docs/cmd/kn_revision_describe.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ kn revision describe NAME [flags]
### Options inherited from parent commands

```
--config string config file (default is $HOME/.kn/config.yaml)
--kubeconfig string kubectl config file (default is $HOME/.kube/config)
--plugin-dir string kn plugin directory (default is value in kn config or $PATH)
```

### SEE ALSO
Expand Down
12 changes: 7 additions & 5 deletions docs/cmd/kn_revision_get.md → docs/cmd/kn_revision_list.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
## kn revision get
## kn revision list

Get available revisions.
List available revisions.

### Synopsis

Get available revisions.
List available revisions.

```
kn revision get [flags]
kn revision list [flags]
```

### Options

```
--all-namespaces If present, list the requested object(s) across all namespaces. Namespace in current context is ignored even if specified with --namespace.
--allow-missing-template-keys If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. (default true)
-h, --help help for get
-h, --help help for list
-n, --namespace string List the requested object(s) in given namespace.
-o, --output string Output format. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-file.
--template string Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].
Expand All @@ -24,7 +24,9 @@ kn revision get [flags]
### Options inherited from parent commands

```
--config string config file (default is $HOME/.kn/config.yaml)
--kubeconfig string kubectl config file (default is $HOME/.kube/config)
--plugin-dir string kn plugin directory (default is value in kn config or $PATH)
```

### SEE ALSO
Expand Down
4 changes: 3 additions & 1 deletion docs/cmd/kn_service.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ Service command group
### Options inherited from parent commands

```
--config string config file (default is $HOME/.kn/config.yaml)
--kubeconfig string kubectl config file (default is $HOME/.kube/config)
--plugin-dir string kn plugin directory (default is value in kn config or $PATH)
```

### SEE ALSO
Expand All @@ -24,6 +26,6 @@ Service command group
* [kn service create](kn_service_create.md) - Create a service.
* [kn service delete](kn_service_delete.md) - Delete a service.
* [kn service describe](kn_service_describe.md) - Describe available services.
* [kn service get](kn_service_get.md) - Get available services.
* [kn service list](kn_service_list.md) - List available services.
* [kn service update](kn_service_update.md) - Update a service.

2 changes: 2 additions & 0 deletions docs/cmd/kn_service_create.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ kn service create NAME --image IMAGE [flags]
### Options inherited from parent commands

```
--config string config file (default is $HOME/.kn/config.yaml)
--kubeconfig string kubectl config file (default is $HOME/.kube/config)
--plugin-dir string kn plugin directory (default is value in kn config or $PATH)
```

### SEE ALSO
Expand Down
2 changes: 2 additions & 0 deletions docs/cmd/kn_service_delete.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ kn service delete NAME [flags]
### Options inherited from parent commands

```
--config string config file (default is $HOME/.kn/config.yaml)
--kubeconfig string kubectl config file (default is $HOME/.kube/config)
--plugin-dir string kn plugin directory (default is value in kn config or $PATH)
```

### SEE ALSO
Expand Down
2 changes: 2 additions & 0 deletions docs/cmd/kn_service_describe.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ kn service describe NAME [flags]
### Options inherited from parent commands

```
--config string config file (default is $HOME/.kn/config.yaml)
--kubeconfig string kubectl config file (default is $HOME/.kube/config)
--plugin-dir string kn plugin directory (default is value in kn config or $PATH)
```

### SEE ALSO
Expand Down
12 changes: 7 additions & 5 deletions docs/cmd/kn_service_get.md → docs/cmd/kn_service_list.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
## kn service get
## kn service list

Get available services.
List available services.

### Synopsis

Get available services.
List available services.

```
kn service get [flags]
kn service list [flags]
```

### Options

```
--all-namespaces If present, list the requested object(s) across all namespaces. Namespace in current context is ignored even if specified with --namespace.
--allow-missing-template-keys If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. (default true)
-h, --help help for get
-h, --help help for list
-n, --namespace string List the requested object(s) in given namespace.
-o, --output string Output format. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-file.
--template string Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].
Expand All @@ -24,7 +24,9 @@ kn service get [flags]
### Options inherited from parent commands

```
--config string config file (default is $HOME/.kn/config.yaml)
--kubeconfig string kubectl config file (default is $HOME/.kube/config)
--plugin-dir string kn plugin directory (default is value in kn config or $PATH)
```

### SEE ALSO
Expand Down
2 changes: 2 additions & 0 deletions docs/cmd/kn_service_update.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ kn service update NAME [flags]
### Options inherited from parent commands

```
--config string config file (default is $HOME/.kn/config.yaml)
--kubeconfig string kubectl config file (default is $HOME/.kube/config)
--plugin-dir string kn plugin directory (default is value in kn config or $PATH)
```

### SEE ALSO
Expand Down
2 changes: 2 additions & 0 deletions docs/cmd/kn_version.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ kn version [flags]
### Options inherited from parent commands

```
--config string config file (default is $HOME/.kn/config.yaml)
--kubeconfig string kubectl config file (default is $HOME/.kube/config)
--plugin-dir string kn plugin directory (default is value in kn config or $PATH)
```

### SEE ALSO
Expand Down
Loading