mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-06 07:57:07 +00:00
* chore: add cli unit tests Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * chore: add cli commands unit tests Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> --------- Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
35 lines
599 B
Go
35 lines
599 B
Go
package docs
|
|
|
|
import (
|
|
"fmt"
|
|
"path"
|
|
"path/filepath"
|
|
"strings"
|
|
"time"
|
|
)
|
|
|
|
const fmTemplate = `---
|
|
date: %s
|
|
title: "%s"
|
|
weight: 35
|
|
---
|
|
`
|
|
|
|
func websitePrepender(filename string) string {
|
|
now := time.Now().Format(time.RFC3339)
|
|
name := filepath.Base(filename)
|
|
base := strings.TrimSuffix(name, path.Ext(name))
|
|
return fmt.Sprintf(fmTemplate, now, strings.Replace(base, "_", " ", -1))
|
|
}
|
|
|
|
func websiteLinkHandler(filename string) string {
|
|
return "../" + strings.TrimSuffix(filename, filepath.Ext(filename))
|
|
}
|
|
|
|
func identity(s string) string {
|
|
return s
|
|
}
|
|
|
|
func empty(s string) string {
|
|
return ""
|
|
}
|