Skip to content
Open
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 15 additions & 13 deletions cmd/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,44 +104,46 @@ COMMANDS
$ {{rootCmdUse}} repository remove <name>

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
`,
Expand Down
12 changes: 7 additions & 5 deletions docs/language-packs/language-pack-contract.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 `<repository-url>` and `<template-name>` 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 <repository-url>
func create myfunc -l go -t custom/<template-name>
```

See the `repository` section of the [commands guide](../reference/func.md) for more information on installing and managing Language Pack repositories.
Expand Down Expand Up @@ -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 <repository-url> # 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/<template-name> # Use a template from the installed repository
```
16 changes: 2 additions & 14 deletions docs/language-packs/templates.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <name> --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 <name> --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 <repository-name>/<template-name>`.

## Language Packs

Expand Down
28 changes: 15 additions & 13 deletions docs/reference/func_repository.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,44 +87,46 @@ COMMANDS
$ func repository remove <name>

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

Expand Down
Loading