8000 generate: allow passing `-` for stdout output by rominf · Pull Request #5053 · restic/restic · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

generate: allow passing - for stdout output #5053

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

Merged
merged 1 commit into from
Oct 9, 2024

Conversation

rominf
Copy link
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
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
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
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
11 checks passed
@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
0