Skip to content

generate: allow passing - for stdout output#5053

Merged
MichaelEischer merged 1 commit intorestic:masterfrom
rominf:rominf-generate-stdout
Oct 9, 2024
Merged

generate: allow passing - for stdout output#5053
MichaelEischer merged 1 commit intorestic:masterfrom
rominf:rominf-generate-stdout

Conversation

@rominf
Copy link
Copy Markdown
Contributor

@rominf rominf commented Sep 13, 2024

What does this PR change? What problem does it solve?

Allow generating shell completions to stdout by supplying - as file name. Since generating completions to stdout for multiple shells does not make sense, enforce - is supplied only once.

Was the change previously discussed in an issue or on the forum?

Closes #2511.

Checklist

  • I have read the contribution guidelines.
  • I have enabled maintainer edits.
  • I have added tests for all code changes.
  • I have added documentation for relevant changes (in the manual).
  • There's a new file in changelog/unreleased/ that describes the changes for our users (see template).
  • I have run gofmt on the code in all commits.
  • All commit messages are formatted in the same style as the other commits in the repo.
  • I'm done! This pull request is ready for review.

Copy link
Copy Markdown
Member

@MichaelEischer MichaelEischer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The check for - should move into the write*Completion functions. That will require a few more changes to avoid additional code duplication, see the comments below.

Since generating completions to stdout for multiple shells does not make
sense, enforce `-` is supplied only once.
@rominf rominf force-pushed the rominf-generate-stdout branch from 5bd8e29 to 3d97656 Compare September 16, 2024 07:54
@rominf
Copy link
Copy Markdown
Contributor Author

rominf commented Sep 16, 2024

Thank you for your review! I applied your suggestions with some minor modifications to make the code compile.

Copy link
Copy Markdown
Member

@MichaelEischer MichaelEischer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Sorry for the delayed review and thanks for improving the generate command!

@MichaelEischer MichaelEischer added this pull request to the merge queue Oct 9, 2024
Merged via the queue into restic:master with commit 7c12bd5 Oct 9, 2024
@rominf rominf deleted the rominf-generate-stdout branch October 10, 2024 05:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Generate autocomplete script to /dev/stdout

2 participants