Skip to content

Commit

Permalink
use examples capability of cobra for zarf init examples, results in b…
Browse files Browse the repository at this point in the history
…etter markdown formatting
  • Loading branch information
dgershman committed Mar 27, 2023
1 parent ff8b5d6 commit 35b974d
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 14 deletions.
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

0 comments on commit 35b974d

Please sign in to comment.