Skip to content

Commit 42cb720

Browse files
committed
feat: add embedded usage markdown files for version commands
1 parent ab30d7d commit 42cb720

File tree

4 files changed

+98
-33
lines changed

4 files changed

+98
-33
lines changed

cmd/version/list.go

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package version
22

33
import (
4+
_ "embed"
45
"fmt"
56
"os"
67
"strings"
@@ -15,6 +16,9 @@ import (
1516
errUtils "github.com/cloudposse/atmos/errors"
1617
)
1718

19+
//go:embed markdown/atmos_version_list_usage.md
20+
var listUsageMarkdown string
21+
1822
const (
1923
listDefaultLimit = 10
2024
listMaxLimit = 100
@@ -110,26 +114,10 @@ func fetchReleasesWithSpinner(client GitHubClient, opts ReleaseOptions) ([]*gith
110114
}
111115

112116
var listCmd = &cobra.Command{
113-
Use: "list",
114-
Short: "List Atmos releases",
115-
Long: `List available Atmos releases from GitHub with pagination and filtering options.`,
116-
Example: ` # List the last 10 releases (default)
117-
atmos version list
118-
119-
# List the last 20 releases
120-
atmos version list --limit 20
121-
122-
# List releases starting from offset 10
123-
atmos version list --offset 10
124-
125-
# Include pre-releases
126-
atmos version list --include-prereleases
127-
128-
# List releases since a specific date
129-
atmos version list --since 2025-01-01
130-
131-
# Output as JSON
132-
atmos version list --format json`,
117+
Use: "list",
118+
Short: "List Atmos releases",
119+
Long: `List available Atmos releases from GitHub with pagination and filtering options.`,
120+
Example: listUsageMarkdown,
133121
RunE: func(cmd *cobra.Command, args []string) error {
134122
// Validate limit.
135123
if listLimit < 1 || listLimit > listMaxLimit {
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
- List the last 10 releases (default)
2+
3+
```
4+
$ atmos version list
5+
```
6+
7+
- List the last 20 releases
8+
9+
```
10+
$ atmos version list --limit 20
11+
```
12+
13+
- List releases starting from offset 10
14+
15+
```
16+
$ atmos version list --offset 10
17+
```
18+
19+
- Include pre-releases
20+
21+
```
22+
$ atmos version list --include-prereleases
23+
```
24+
25+
- List releases since a specific date
26+
27+
```
28+
$ atmos version list --since 2025-01-01
29+
```
30+
31+
- Output as JSON
32+
33+
```
34+
$ atmos version list --format json
35+
```
36+
37+
- Output as YAML
38+
39+
```
40+
$ atmos version list --format yaml
41+
```
42+
43+
- Combine multiple options
44+
45+
```
46+
$ atmos version list --limit 5 --include-prereleases --format json
47+
```
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
- Show details for the latest release
2+
3+
```
4+
$ atmos version show
5+
```
6+
7+
- Show details for a specific version
8+
9+
```
10+
$ atmos version show v1.194.0
11+
```
12+
13+
- Show details without the 'v' prefix
14+
15+
```
16+
$ atmos version show 1.194.0
17+
```
18+
19+
- Output as JSON
20+
21+
```
22+
$ atmos version show v1.194.0 --format json
23+
```
24+
25+
- Output as YAML
26+
27+
```
28+
$ atmos version show v1.194.0 --format yaml
29+
```

cmd/version/show.go

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package version
22

33
import (
4+
_ "embed"
45
"fmt"
56
"os"
67
"strings"
@@ -14,6 +15,9 @@ import (
1415
errUtils "github.com/cloudposse/atmos/errors"
1516
)
1617

18+
//go:embed markdown/atmos_version_show_usage.md
19+
var showUsageMarkdown string
20+
1721
var showFormat string
1822

1923
type showModel struct {
@@ -116,20 +120,17 @@ func fetchReleaseWithSpinner(client GitHubClient, versionArg string) (*github.Re
116120
}
117121

118122
var showCmd = &cobra.Command{
119-
Use: "show <version>",
120-
Short: "Show details for a specific Atmos release",
121-
Long: `Display detailed information about a specific Atmos release including release notes and download links.`,
122-
Example: ` # Show details for a specific version
123-
atmos version show v1.95.0
124-
125-
# Show details for the latest release
126-
atmos version show latest
127-
128-
# Output as JSON
129-
atmos version show v1.95.0 --format json`,
130-
Args: cobra.ExactArgs(1),
123+
Use: "show [version]",
124+
Short: "Show details for a specific Atmos release",
125+
Long: `Display detailed information about a specific Atmos release including release notes and download links.`,
126+
Example: showUsageMarkdown,
127+
Args: cobra.MaximumNArgs(1),
131128
RunE: func(cmd *cobra.Command, args []string) error {
132-
versionArg := args[0]
129+
// Default to latest if no version specified.
130+
versionArg := ""
131+
if len(args) > 0 {
132+
versionArg = args[0]
133+
}
133134

134135
// Create GitHub client.
135136
client := &RealGitHubClient{}

0 commit comments

Comments
 (0)