Skip to content

Commit 0bd9d8f

Browse files
authored
Merge pull request #135 from nicholasSUSE/doc-improvements-cli
small improvements to CLI help documentation
2 parents 9cd4563 + 416c979 commit 0bd9d8f

File tree

1 file changed

+43
-12
lines changed

1 file changed

+43
-12
lines changed

main.go

Lines changed: 43 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ const (
4141
DefaultCacheEnvironmentVariable = "USE_CACHE"
4242
// DefaultDebugEnvironmentVariable is the default environment variable that indicates that debug mode should be enabled
4343
DefaultDebugEnvironmentVariable = "DEBUG"
44+
// DefaultBranchVersionEnvironmentVariable is the default environment variable that indicates the branch version to compare against
45+
DefaultBranchVersionEnvironmentVariable = "BRANCH_VERSION"
4446
)
4547

4648
var (
@@ -94,8 +96,14 @@ func main() {
9496
EnvVar: DefaultPackageEnvironmentVariable,
9597
}
9698
chartFlag := cli.StringFlag{
97-
Name: "chart,c",
98-
Usage: "A chart you would like to run the scripts on. Can include version.",
99+
Name: "chart,c",
100+
Usage: `Usage:
101+
./bin/charts-build-scripts <some_command> --chart="chart-name"
102+
CHART=<chart_name> make <some_command>
103+
104+
A chart you would like to run the scripts on. Can include version.
105+
Default Environment Variable:
106+
`,
99107
Required: false,
100108
Destination: &CurrentChart,
101109
EnvVar: DefaultChartEnvironmentVariable,
@@ -122,12 +130,27 @@ func main() {
122130
EnvVar: DefaultCacheEnvironmentVariable,
123131
}
124132
branchVersionFlag := cli.StringFlag{
125-
Name: "branch-version",
126-
Usage: "Available inputs: (2.5; 2.6; 2.7; 2.8; 2.9). The branch version to compare against. This is used to determine which assets to remove from the repository. ",
133+
Name: "branch-version",
134+
Usage: `Usage:
135+
./bin/charts-build-scripts <command> --branch-version="x.y"
136+
BRANCH_VERSION="x.y" make <command>
137+
138+
The branch version line to compare against.
139+
Available inputs: (2.5; 2.6; 2.7; 2.8; 2.9).
140+
Default Environment Variable:
141+
`,
142+
Required: true,
143+
EnvVar: DefaultBranchVersionEnvironmentVariable,
127144
}
128145
debugFlag := cli.BoolFlag{
129-
Name: "debugFlag",
130-
Usage: "Enable debug mode",
146+
Name: "debug",
147+
Usage: `Usage:
148+
./bin/charts-build-scripts <some_command> --debug=true
149+
DEBUG=true make <some_command>
150+
151+
Enable debug mode with more verbose output
152+
Default Environment Variable:
153+
`,
131154
Destination: &DebugMode,
132155
EnvVar: DefaultDebugEnvironmentVariable,
133156
}
@@ -252,14 +275,18 @@ func main() {
252275
Flags: []cli.Flag{packageFlag, configFlag, cacheFlag},
253276
},
254277
{
255-
Name: "lifecycle-assets",
256-
Usage: "Clean up assets that don't belong on this branch",
257-
Action: lifecycleAssetsClean,
278+
Name: "enforce-lifecycle",
279+
Usage: `(work in progress)
280+
Remove all assets versions that don't belong on this branch according to the lifecycle rules.
281+
All assets versions that are older than 3 minor versions from the provided branch version(2.7; 2.8; 2.9) will be removed.
282+
`,
283+
Action: enforceLifecycle,
258284
Flags: []cli.Flag{branchVersionFlag, chartFlag, debugFlag},
259285
},
260286
{
261-
Name: "lifecycle-status",
262-
Usage: "Get the status of the current assets and charts based on the branch version and chart version according to the lifecycle rules",
287+
Name: "lifecycle-status",
288+
Usage: `Print the status of the current assets and charts based on the branch version and chart version according to the lifecycle rules.
289+
Saves the logs in the logs/ directory.`,
263290
Action: lifecycleStatus,
264291
Flags: []cli.Flag{branchVersionFlag, chartFlag},
265292
},
@@ -562,10 +589,12 @@ func checkRCTagsAndVersions(c *cli.Context) {
562589
logrus.Info("RC check has succeeded")
563590
}
564591

565-
func lifecycleAssetsClean(c *cli.Context) {
592+
func enforceLifecycle(c *cli.Context) {
593+
566594
// Initialize dependencies with branch-version, current chart and debug mode
567595
repoRoot := getRepoRoot()
568596
rootFs := filesystem.GetFilesystem(repoRoot)
597+
569598
lifeCycleDep, err := lifecycle.InitDependencies(rootFs, c.String("branch-version"), CurrentChart, DebugMode)
570599
if err != nil {
571600
logrus.Fatalf("encountered error while initializing dependencies for lifecycle-assets-clean: %s", err)
@@ -579,8 +608,10 @@ func lifecycleAssetsClean(c *cli.Context) {
579608
}
580609

581610
func lifecycleStatus(c *cli.Context) {
611+
582612
// Initialize dependencies with branch-version and current chart
583613
rootFs := filesystem.GetFilesystem(getRepoRoot())
614+
584615
lifeCycleDep, err := lifecycle.InitDependencies(rootFs, c.String("branch-version"), CurrentChart, false)
585616
if err != nil {
586617
logrus.Fatalf("encountered error while initializing dependencies for lifecycle-assets-clean: %s", err)

0 commit comments

Comments
 (0)