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

use examples capability of cobra for zarf init examples, results in b… #1492

Merged
merged 1 commit into from
Mar 27, 2023
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
14 changes: 9 additions & 5 deletions docs/4-user-guide/1-the-zarf-cli/100-cli-commands/zarf_init.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,15 @@ This command looks for a zarf-init package in the local directory that the comma



Example Usage:


```
zarf init [flags]
```

## Examples

```
# Initializing without any optional components:
zarf init

Expand All @@ -31,10 +39,6 @@ zarf init --registry-push-password={PASSWORD} --registry-push-username={USERNAME
# Initializing w/ an external git server:
zarf init --git-push-password={PASSWORD} --git-push-username={USERNAME} --git-url={URL}



```
zarf init [flags]
```

## Options
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/initialize.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ var initCmd = &cobra.Command{
Aliases: []string{"i"},
Short: lang.CmdInitShort,
Long: lang.CmdInitLong,

Example: lang.CmdInitExample,
Run: func(cmd *cobra.Command, args []string) {
zarfLogo := message.GetLogo()
_, _ = fmt.Fprintln(os.Stderr, zarfLogo)
Expand Down
28 changes: 20 additions & 8 deletions src/config/lang/english.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,26 @@ const (
"This command looks for a zarf-init package in the local directory that the command was executed " +
"from. If no package is found in the local directory and the Zarf CLI exists somewhere outside of " +
"the current directory, Zarf will failover and attempt to find a zarf-init package in the directory " +
"that the Zarf binary is located in.\n\n\n\n" +
"Example Usage:\n" +
"# Initializing without any optional components:\nzarf init\n\n" +
"# Initializing w/ Zarfs internal git server:\nzarf init --components=git-server\n\n" +
"# Initializing w/ Zarfs internal git server and PLG stack:\nzarf init --components=git-server,logging\n\n" +
"# Initializing w/ an internal registry but with a different nodeport:\nzarf init --nodeport=30333\n\n" +
"# Initializing w/ an external registry:\nzarf init --registry-push-password={PASSWORD} --registry-push-username={USERNAME} --registry-url={URL}\n\n" +
"# Initializing w/ an external git server:\nzarf init --git-push-password={PASSWORD} --git-push-username={USERNAME} --git-url={URL}\n\n"
"that the Zarf binary is located in.\n\n\n\n"

CmdInitExample = `# Initializing without any optional components:
zarf init

# Initializing w/ Zarfs internal git server:
zarf init --components=git-server

# Initializing w/ Zarfs internal git server and PLG stack:
zarf init --components=git-server,logging

# Initializing w/ an internal registry but with a different nodeport:
zarf init --nodeport=30333

# Initializing w/ an external registry:
zarf init --registry-push-password={PASSWORD} --registry-push-username={USERNAME} --registry-url={URL}

# Initializing w/ an external git server:
zarf init --git-push-password={PASSWORD} --git-push-username={USERNAME} --git-url={URL}
`

CmdInitErrFlags = "Invalid command flags were provided."
CmdInitErrDownload = "failed to download the init package: %s"
Expand Down