Skip to content

docs: Add CLI docs #5879

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

Merged
merged 15 commits into from
Jan 27, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Remove coder version from the docs
  • Loading branch information
BrunoQuaresma committed Jan 27, 2023
commit df26b83ac64ab3bbfd909b5b73b79b4aeafc3ede
2 changes: 1 addition & 1 deletion docs/cli/coder.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

### Synopsis

Coder v0.0.0-devel — A tool for provisioning self-hosted development environments with Terraform.
Coder — A tool for provisioning self-hosted development environments with Terraform.

```
coder [flags]
Expand Down
15 changes: 11 additions & 4 deletions scripts/clidocgen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (

"github.com/spf13/cobra/doc"

"github.com/coder/coder/buildinfo"
"github.com/coder/coder/cli"
)

Expand Down Expand Up @@ -68,17 +69,23 @@ func main() {
Path: "./cli/" + file.Name(),
})

// Remove non printable strings from generated markdown
// https://github.com/spf13/cobra/issues/1878
const ansi = "[\u001B\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[a-zA-Z\\d]*)*)?\u0007)|(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"
ansiRegex := regexp.MustCompile(ansi)
filepath := path.Join(markdownDocsDir, file.Name())
openFile, err := os.ReadFile(filepath)
if err != nil {
log.Fatal("Error on open file at ", filepath, ": ", err)
}
content := string(openFile)

// Remove non printable strings from generated markdown
// https://github.com/spf13/cobra/issues/1878
const ansi = "[\u001B\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[a-zA-Z\\d]*)*)?\u0007)|(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"
ansiRegex := regexp.MustCompile(ansi)
content = ansiRegex.ReplaceAllString(content, "")

// Remove the version and its right space, since during this script running
// there is no build info available
content = strings.ReplaceAll(content, buildinfo.Version()+" ", "")

err = os.WriteFile(filepath, []byte(content), 0644) // #nosec
if err != nil {
log.Fatal("Error on save file at ", filepath, ": ", err)
Expand Down