Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove files properly on generate cli docs and check errors #943

Merged
merged 2 commits into from
Oct 27, 2022
Merged
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

This file was deleted.

This file was deleted.

This file was deleted.

13 changes: 12 additions & 1 deletion src/cmd/internal.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package cmd
import (
"encoding/json"
"fmt"
"os"

"github.com/alecthomas/jsonschema"
"github.com/defenseunicorns/zarf/src/config"
Expand Down Expand Up @@ -41,7 +42,17 @@ var generateCLIDocs = &cobra.Command{
// Don't include the datestamp in the output
rootCmd.DisableAutoGenTag = true
//Generate markdown of the Zarf command (and all of its child commands)
doc.GenMarkdownTree(rootCmd, "./docs/4-user-guide/1-the-zarf-cli/100-cli-commands")
if err := os.RemoveAll("./docs/4-user-guide/1-the-zarf-cli/100-cli-commands"); err != nil {
message.Fatalf("Unable to generate the CLI documentation: %s", err.Error())
}
if err := os.Mkdir("./docs/4-user-guide/1-the-zarf-cli/100-cli-commands", 0775); err != nil {
message.Fatalf("Unable to generate the CLI documentation: %s", err.Error())
}
if err := doc.GenMarkdownTree(rootCmd, "./docs/4-user-guide/1-the-zarf-cli/100-cli-commands"); err != nil {
message.Fatalf("Unable to generate the CLI documentation: %s", err.Error())
} else {
message.SuccessF("Successfully created the CLI documentation")
}
},
}

Expand Down