diff --git a/cmd/repository.go b/cmd/repository.go index fb29337016..23f494cd45 100644 --- a/cmd/repository.go +++ b/cmd/repository.go @@ -104,44 +104,46 @@ COMMANDS $ {{rootCmdUse}} repository remove EXAMPLES + Replace the example repository URL and template names with your own. + o Run in confirmation mode (interactive prompts) using the --confirm flag $ {{rootCmdUse}} repository -c o Add a repository and create a new function using a template from it: - $ {{rootCmdUse}} repository add functastic https://github.com/knative-extensions/func-tastic + $ {{rootCmdUse}} repository add custom https://example.com/function-templates $ {{rootCmdUse}} repository list default - functastic - $ {{rootCmdUse}} create -l go -t functastic/hello-world + custom + $ {{rootCmdUse}} create -l go -t custom/hello-world ... - o Add a repository specifying the branch to use (metacontroller): - $ {{rootCmdUse}} repository add metacontroller https://github.com/knative-extensions/func-tastic#metacontroler + o Add a repository specifying the branch to use: + $ {{rootCmdUse}} repository add custom-branch https://example.com/function-templates#my-branch $ {{rootCmdUse}} repository list default - metacontroller - $ {{rootCmdUse}} create -l node -t metacontroller/metacontroller + custom-branch + $ {{rootCmdUse}} create -l node -t custom-branch/events ... o List all repositories including the URL from which remotes were installed $ {{rootCmdUse}} repository list -v default - metacontroller https://github.com/knative-extensions/func-tastic#metacontroller + custom https://example.com/function-templates o Rename an installed repository $ {{rootCmdUse}} repository list default - boson - $ {{rootCmdUse}} repository rename boson functastic + custom + $ {{rootCmdUse}} repository rename custom team-templates $ {{rootCmdUse}} repository list default - functastic + team-templates o Remove an installed repository $ {{rootCmdUse}} repository list default - functastic - $ {{rootCmdUse}} repository remove functastic + team-templates + $ {{rootCmdUse}} repository remove team-templates $ {{rootCmdUse}} repository list default `, diff --git a/docs/language-packs/language-pack-contract.md b/docs/language-packs/language-pack-contract.md index 52aeb802bb..9401189def 100644 --- a/docs/language-packs/language-pack-contract.md +++ b/docs/language-packs/language-pack-contract.md @@ -136,9 +136,11 @@ Built in to the Functions library are Language Packs for Go, Node.js, Python, Qu Language Packs are distributed as a set of templates for one or more languages via Git repositories, and installed by the developer locally using the `func` CLI. +Replace `` and `` with values for your language pack: + ``` -func repository add func https://github.com/knative-extensions/func-tastic -func create -l go -t func/hello-world +func repository add custom +func create myfunc -l go -t custom/ ``` See the `repository` section of the [commands guide](../reference/func.md) for more information on installing and managing Language Pack repositories. @@ -190,9 +192,9 @@ When `func create` is used to generate a Function project, the Language Pack pro Using external Language Packs is made possible through the `func repository` command, which allows Function developers to add and remove Language Packs from their local development environment. For example: ``` -❯ func repository add https://github.com/knative-extensions/func-tastic functastic # Add the func-tastic repo to the local environment +❯ func repository add custom # Add your template repository ❯ func repo list # list repos default -functastic -❯ func create -l node -t functastic/events # create a Node.js CloudEvents template from the now-local functastic repo +custom +❯ func create myfunc -l node -t custom/ # Use a template from the installed repository ``` diff --git a/docs/language-packs/templates.md b/docs/language-packs/templates.md index b6d3c1c4cc..51a99b46cf 100644 --- a/docs/language-packs/templates.md +++ b/docs/language-packs/templates.md @@ -8,25 +8,13 @@ To make use of more complex initial function implementations, or to define runti ## External Git Repositories -When creating a new function, a Git repository can be specified as the source for the template files. For example, the the [knative-extensions/func-tastic repository](https://github.com/knative-extensions/func-tastic) contains a set of example functions which can be used during project creation. - -For example, the func-tastic repository contains an example ["metacontroller"](https://metacontroller.github.io/metacontroller) function implementation for Node.js. To use this template via the CLI, use the flags: - -func create --template metacontroller --repository https://github.com/knative-extensions/func-tastic +When creating a new function, a Git repository can be specified as the source for the template files using the `--repository` flag. Use `--template` to select a template from that repository. ## Locally Installing Repositories Template repositories can also be installed locally by placing them in the functions configuration directory. -To install the func-tastic templates locally, for example, use the `func repository add` command: - -``` -func repository add https://github.com/knative-extensions/func-tastic -``` - -Once installed, the metacontroller template can be specified: - -func create --template func-tastic/metacontroller +Use the [`func repository add`](../reference/func_repository.md) command to install a template repository locally. Once installed, select a template by prefixing its name with the repository name: `--template /`. ## Language Packs diff --git a/docs/reference/func_repository.md b/docs/reference/func_repository.md index bc99b53026..150594c131 100644 --- a/docs/reference/func_repository.md +++ b/docs/reference/func_repository.md @@ -87,44 +87,46 @@ COMMANDS $ func repository remove EXAMPLES + Replace the example repository URL and template names with your own. + o Run in confirmation mode (interactive prompts) using the --confirm flag $ func repository -c o Add a repository and create a new function using a template from it: - $ func repository add functastic https://github.com/knative-extensions/func-tastic + $ func repository add custom https://example.com/function-templates $ func repository list default - functastic - $ func create -l go -t functastic/hello-world + custom + $ func create -l go -t custom/hello-world ... - o Add a repository specifying the branch to use (metacontroller): - $ func repository add metacontroller https://github.com/knative-extensions/func-tastic#metacontroler + o Add a repository specifying the branch to use: + $ func repository add custom-branch https://example.com/function-templates#my-branch $ func repository list default - metacontroller - $ func create -l node -t metacontroller/metacontroller + custom-branch + $ func create -l node -t custom-branch/events ... o List all repositories including the URL from which remotes were installed $ func repository list -v default - metacontroller https://github.com/knative-extensions/func-tastic#metacontroller + custom https://example.com/function-templates o Rename an installed repository $ func repository list default - boson - $ func repository rename boson functastic + custom + $ func repository rename custom team-templates $ func repository list default - functastic + team-templates o Remove an installed repository $ func repository list default - functastic - $ func repository remove functastic + team-templates + $ func repository remove team-templates $ func repository list default