Skip to content

Commit

Permalink
Generate older aliases to pack documentation
Browse files Browse the repository at this point in the history
When generating the pack cli docs, create aliases
using the older document structure

Signed-off-by: Aidan Delaney <[email protected]>
  • Loading branch information
AidanDelaney committed Feb 29, 2024
1 parent 04677b7 commit a6d67c3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tools/get_pack_commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const (
gendocFrontmatterTemplate = `+++
title="%s"
no_edit="true"
aliases=[ "/docs/tools/pack" ]
+++
<!--more-->
`
Expand All @@ -30,7 +31,8 @@ no_edit="true"
var filePrepender = func(filename string) string {
name := filepath.Base(filename)
name = strings.Replace(name, ".md", "", -1)
return fmt.Sprintf(gendocFrontmatterTemplate, strings.Replace(name, "_", " ", -1))
presentationName := strings.Replace(name, "_", " ", -1)
return fmt.Sprintf(gendocFrontmatterTemplate, presentationName)
}

var linkHandler = func(name string) string {
Expand All @@ -52,7 +54,7 @@ func main() {
}

if _, err := os.Stat(filepath.Join(outputPath, indexFile)); os.IsNotExist(err) {
if err := ioutil.WriteFile(filepath.Join(outputPath, indexFile), []byte(filePrepender("Pack CLI")), os.ModePerm); err != nil {
if err := os.WriteFile(filepath.Join(outputPath, indexFile), []byte(filePrepender("Pack CLI")), os.ModePerm); err != nil {
log.Fatal(err)
}
}
Expand Down

0 comments on commit a6d67c3

Please sign in to comment.