Skip to content
This repository has been archived by the owner on Oct 29, 2023. It is now read-only.

Commit

Permalink
Fix error handling on default dir detection
Browse files Browse the repository at this point in the history
Fix error handling on default dir detection for bash completion.
  • Loading branch information
datacharmer committed Jun 15, 2020
1 parent f3f536f commit 1d0f472
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .build/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.51.1
1.51.2
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 1.51.2 15-Jun-2020

### BUGS FIXED

* Fix error handling on default directories detection for bash completion.

## 1.51.1 14-Jun-2020

### BUGS FIXED
Expand Down
19 changes: 10 additions & 9 deletions cmd/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,18 +114,19 @@ func enableBashCompletion(cmd *cobra.Command, args []string) {
destinationDir := path.Join("/etc", "bash_completion.d")
alternateDestinationDir := path.Join("/usr", "local", "etc", "bash_completion.d")
if !common.DirExists(destinationDir) {
destinationDir = alternateDestinationDir
}
if !common.DirExists(destinationDir) {
common.Exitf(1, "neither %s or %s found", destinationDir, alternateDestinationDir)
}
if !common.FileExists(bashCompletionScript) {
bashCompletionScript = alternateBashCompletionScript
if common.DirExists(alternateDestinationDir) {
destinationDir = alternateDestinationDir
} else {
common.Exitf(1, "neither %s or %s found", destinationDir, alternateDestinationDir)
}
}
if !common.FileExists(bashCompletionScript) {
common.Exitf(1, "neither %s or %s found", bashCompletionScript, alternateBashCompletionScript)
if common.FileExists(bashCompletionScript) {
bashCompletionScript = alternateBashCompletionScript
} else {
common.Exitf(1, "neither %s or %s found", bashCompletionScript, alternateBashCompletionScript)
}
}

if completionFile == "" {
completionFile = globals.CompletionFileValue
}
Expand Down
4 changes: 2 additions & 2 deletions common/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
package common

// This file was generated during build. Do not edit.
// Build time: 2020-06-14 08:47
// Build time: 2020-06-15 13:30

var VersionDef string = "1.51.1" // 2020-06-14
var VersionDef string = "1.51.2" // 2020-06-15

// Compatible version is the version used to mark compatible archives (templates, configuration).
// It is usually major.minor.0, except when we are at version 0.x, when
Expand Down

0 comments on commit 1d0f472

Please sign in to comment.