2
2
mirror of https://github.com/octoleo/restic.git synced 2024-12-23 19:38:57 +00:00

generate: write progress to STDOUT if this is a terminal

This allows usage as:

  eval "$(restic generated --bash-completion /dev/stdout)"
This commit is contained in:
Heiko Schlittermann (HS12-RIPE) 2023-03-22 08:18:08 +01:00
parent bdcafbc11c
commit 087cf7e114
No known key found for this signature in database
GPG Key ID: AF4CC676A6B6C142

View File

@ -63,22 +63,30 @@ func writeManpages(dir string) error {
} }
func writeBashCompletion(file string) error { func writeBashCompletion(file string) error {
Verbosef("writing bash completion file to %v\n", file) if stdoutIsTerminal() {
Verbosef("writing bash completion file to %v\n", file)
}
return cmdRoot.GenBashCompletionFile(file) return cmdRoot.GenBashCompletionFile(file)
} }
func writeFishCompletion(file string) error { func writeFishCompletion(file string) error {
Verbosef("writing fish completion file to %v\n", file) if stdoutIsTerminal() {
Verbosef("writing fish completion file to %v\n", file)
}
return cmdRoot.GenFishCompletionFile(file, true) return cmdRoot.GenFishCompletionFile(file, true)
} }
func writeZSHCompletion(file string) error { func writeZSHCompletion(file string) error {
Verbosef("writing zsh completion file to %v\n", file) if stdoutIsTerminal() {
Verbosef("writing zsh completion file to %v\n", file)
}
return cmdRoot.GenZshCompletionFile(file) return cmdRoot.GenZshCompletionFile(file)
} }
func writePowerShellCompletion(file string) error { func writePowerShellCompletion(file string) error {
Verbosef("writing powershell completion file to %v\n", file) if stdoutIsTerminal() {
Verbosef("writing powershell completion file to %v\n", file)
}
return cmdRoot.GenPowerShellCompletionFile(file) return cmdRoot.GenPowerShellCompletionFile(file)
} }