1
0
Fork 0
mirror of https://github.com/restic/restic.git synced 2024-12-26 17:57:50 +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 {
Verbosef("writing bash completion file to %v\n", file)
if stdoutIsTerminal() {
Verbosef("writing bash completion file to %v\n", file)
}
return cmdRoot.GenBashCompletionFile(file)
}
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)
}
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)
}
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)
}