-
Notifications
You must be signed in to change notification settings - Fork 6
refactor(pass): extract multi-line Long descriptions to embedded mark down #533
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| Scans the current environment (plus any `--env-file` inputs) for variables | ||
| whose value is exactly `se://<ID|pattern>`. Each reference is resolved through the | ||
| secrets-engine daemon and the resolved value is passed to the child process. | ||
| The child inherits stdin, stdout, and stderr. | ||
|
|
||
| Requires the secrets-engine daemon (Docker Desktop) to be running. | ||
|
|
||
| If any reference cannot be resolved, the command fails before the child is | ||
| started and exits non-zero. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,6 +33,9 @@ import ( | |
| //go:embed set_example.md | ||
| var setExample string | ||
|
|
||
| //go:embed set_long.md | ||
| var setLong string | ||
|
|
||
| type setOpts struct { | ||
| metadata []string // raw "key=value" strings from --metadata flag | ||
| force bool // if true, overwrite existing secret instead of erroring | ||
|
|
@@ -49,16 +52,7 @@ func SetCommand(kc store.Store) *cobra.Command { | |
| Use: "set id[=value]", | ||
| Aliases: []string{"store", "save"}, | ||
| Short: "Set a secret", | ||
| Long: "Stores a secret in the local OS keychain. The secret value can be provided inline (`NAME=VALUE`) or piped via STDIN.\n" + | ||
| "\n" + | ||
| "Behavior when a secret with the same id already exists is platform-dependent:\n" + | ||
| " - macOS (Keychain): the command fails with a duplicate-item error.\n" + | ||
| " - Linux (Secret Service) and Windows (Credential Manager): the existing\n" + | ||
| " value is silently overwritten.\n" + | ||
| "\n" + | ||
| "Pass `--force` to overwrite an existing secret. On Linux and Windows the\n" + | ||
| "replacement is performed atomically. On macOS the Keychain API requires\n" + | ||
| "a delete-then-add sequence.", | ||
| Long: strings.Trim(setLong, "\n"), | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. LOW: Inconsistent whitespace trimming — only newlines stripped,
Same concern as |
||
| Example: strings.Trim(setExample, "\n"), | ||
| Args: cobra.ExactArgs(1), | ||
| RunE: func(cmd *cobra.Command, args []string) error { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| Stores a secret in the local OS keychain. The secret value can be provided inline (`NAME=VALUE`) or piped via STDIN. | ||
|
|
||
| Behavior when a secret with the same id already exists is platform-dependent: | ||
| - macOS (Keychain): the command fails with a duplicate-item error. | ||
| - Linux (Secret Service) and Windows (Credential Manager): the existing | ||
| value is silently overwritten. | ||
|
|
||
| Pass `--force` to overwrite an existing secret. On Linux and Windows the | ||
| replacement is performed atomically. On macOS the Keychain API requires | ||
| a delete-then-add sequence. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| Docker Pass is a helper for securely storing secrets in your local OS keychain and injecting them into containers when needed. | ||
| It uses platform-specific credential storage: | ||
|
|
||
| - Windows: Windows Credential Manager API | ||
| - macOS: Keychain services API | ||
| - Linux: `org.freedesktop.secrets` API (requires DBus + `gnome-keyring` or `kdewallet`) | ||
|
|
||
| Secrets can be injected into running containers at runtime using the `se://` URI scheme. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LOW: Inconsistent whitespace trimming — only newlines stripped,
\rand spaces would survivestrings.Trim(runLong, "\n")strips only newline characters from both ends of the embedded string, whilecommand.gousesstrings.TrimSpace(rootLong)which also removes carriage-returns, spaces, and tabs.If
run_long.mdever gains a trailing\r(e.g. committed from a Windows editor before git normalises line endings), it will appear verbatim in the CobraLonghelp output. Consider usingstrings.TrimSpacehere to match the root command and be robust to accidental whitespace.