From ec964ff41dc981d62f0ac0fa2308a3bc9143ac67 Mon Sep 17 00:00:00 2001 From: Andrew Stuart Date: Fri, 9 Dec 2016 13:18:33 -0700 Subject: [PATCH] Add documentation for imported golang.org/pkg/path funcs --- docs/chart_template_guide/accessing_files.md | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/docs/chart_template_guide/accessing_files.md b/docs/chart_template_guide/accessing_files.md index ca87469f3..d2ee57ffa 100644 --- a/docs/chart_template_guide/accessing_files.md +++ b/docs/chart_template_guide/accessing_files.md @@ -14,6 +14,7 @@ Helm provides access to files through the `.Files` object. Before we get going w - [Basic example](#basic-example) +- [Path helpers](#path-helpers) - [Glob patterns](#glob-patterns) - [ConfigMap and Secrets utility functions](#configmap-and-secrets-utility-functions) - [Secrets](#secrets) @@ -78,11 +79,26 @@ data: message = Goodbye from config 3 ``` +## Path helpers + +When working with files, it can be very useful to perform some standard +operations on the file paths themselves. To help with this, Helm imports many of +the functions from Go's [path](https://golang.org/pkg/path/) package for your +use. They are all accessible with the same names as in the Go package, but +with a lowercase first letter. For example, `Base` becomes `base`, etc. + +The imported functions are: +- Base +- Dir +- Ext +- IsAbs +- Clean + ## Glob patterns As your chart grows, you may find you have a greater need to organize your files more, and so we provide a `Files.Glob(pattern string)` method to assist -in extracting certain files with all the flexibility of [glob patterns](//godoc.org/github.com/gobwas/glob). +in extracting certain files with all the flexibility of [glob patterns](https://godoc.org/github.com/gobwas/glob). `.Glob` returns a `Files` type, so you may call any of the `Files` methods on the returned object.