From 7a6c5faba15a6b671d3f5647c473d0c9182854ed Mon Sep 17 00:00:00 2001 From: Ariel Mashraki Date: Mon, 17 Feb 2025 12:48:01 +0200 Subject: [PATCH] cmd/atlas: remove unused cli doc ref generation from --- cmd/atlas/doc.go | 68 --------------------------------------- cmd/atlas/doc.tmpl | 79 ---------------------------------------------- 2 files changed, 147 deletions(-) delete mode 100644 cmd/atlas/doc.go delete mode 100644 cmd/atlas/doc.tmpl diff --git a/cmd/atlas/doc.go b/cmd/atlas/doc.go deleted file mode 100644 index 787c657896a..00000000000 --- a/cmd/atlas/doc.go +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2021-present The Atlas Authors. All rights reserved. -// This source code is licensed under the Apache 2.0 license found -// in the LICENSE file in the root directory of this source tree. - -//go:build ignore -// +build ignore - -package main - -import ( - "log" - "os" - "strings" - "text/template" - - "ariga.io/atlas/cmd/atlas/internal/cmdapi" - - "github.com/spf13/cobra" -) - -func main() { - f, err := os.Create("../../doc/md/reference.md") - if err != nil { - log.Fatal(err) - } - t, err := template.New(""). - Funcs(template.FuncMap{ - "header": func(depth int) string { - return strings.Repeat("#", depth+1) - }, - "subheader": func(depth int) string { - return strings.Repeat("#", depth+2) - }, - }). - ParseFiles("doc.tmpl") - if err != nil { - log.Fatal(err) - } - if err := t.ExecuteTemplate(f, "header", nil); err != nil { - log.Fatal(err) - } - blocks := prepare(cmdapi.Root, make([]*block, 0), 0) - if err := t.ExecuteTemplate(f, "body", struct { - Blocks []*block - }{Blocks: blocks}); err != nil { - log.Fatal(err) - } -} - -type block struct { - Depth int - *cobra.Command -} - -func prepare(cmd *cobra.Command, existing []*block, depth int) []*block { - if depth > 0 { - existing = append(existing, &block{ - Depth: depth, - Command: cmd, - }) - } - for _, child := range cmd.Commands() { - if !child.Hidden { - existing = prepare(child, existing, depth+1) - } - } - return existing -} diff --git a/cmd/atlas/doc.tmpl b/cmd/atlas/doc.tmpl deleted file mode 100644 index caa34394cd2..00000000000 --- a/cmd/atlas/doc.tmpl +++ /dev/null @@ -1,79 +0,0 @@ -{{- define "header" -}} ---- -title: CLI Reference -id: cli-reference -slug: cli-reference ---- -{{- end }} -{{ define "body" }} - -## Introduction - -This document serves as reference documentation for all available commands in the Atlas CLI. -Similar information can be obtained by running any atlas command with the `-h` or `--help` -flags. - -For a more detailed introduction to the CLI capabilities, head over to the -[Getting Started](/getting-started/) page. - -## Supported Version Policy - -To ensure the best performance, security and compatibility with the Atlas Cloud service, the Atlas team -will only support the two most recent minor versions of the CLI. For example, if the latest version is -`v0.25`, the supported versions will be `v0.24` and `v0.25` (in addition to any patch releases and the -"canary" release which is built twice a day). - -## Distributed Binaries - -:::info Old Versions - -As part of our **Supported Version Policy** mentioned above, binaries for versions that were published -more than 6 months ago will be removed from the CDN and Docker Hub. - -::: - -The binaries and Docker images distributed in official releases are released in two flavors: - -* Atlas - A binary built from the OSS repository in addition to proprietary code maintained by - [Ariga](https://ariga.io), including access to the Atlas Cloud service and commercial driver support. - Atlas is distributed under the [Atlas EULA](https://ariga.io/legal/atlas/eula). -* Atlas Community - A binary built from the OSS repository only. Atlas Community is distributed under - the [Apache 2 License](https://github.com/ariga/atlas/blob/master/LICENSE). - -For instructions on how to install Atlas Community, see this [guide](/community-edition). - -{{ range .Blocks }} -{{ header .Depth }} {{ .CommandPath }} - -{{ .Short }} - -{{- if .UseLine }} - -#### Usage -``` -{{ .UseLine }} -``` -{{- end }} -{{- if .Long }} - -#### Details -{{ .Long }} -{{- end }} -{{ if .Example }} -#### Example - -``` -{{ .Example }} -``` -{{- end }} - -{{- $flags := .NonInheritedFlags }} -{{- if $flags.HasAvailableFlags }} -#### Flags -``` -{{ $flags.FlagUsages }} -``` -{{ end }} -{{ end }} - -{{ end }}