forked from gopasspw/gopass
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Warn when throw-keyids is set (gopasspw#1759)
Fixes gopasspw#1756 RELEASE_NOTES=[BUGFIX] Warn about --throw-keyids Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
- Loading branch information
1 parent
02e7ebd
commit d1af426
Showing
3 changed files
with
46 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package cli | ||
|
||
import ( | ||
"bufio" | ||
"os" | ||
"path/filepath" | ||
"strings" | ||
|
||
"github.com/gopasspw/gopass/pkg/debug" | ||
) | ||
|
||
func gpgConfigLoc() string { | ||
if sv := os.Getenv("GNUPGHOME"); sv != "" { | ||
return filepath.Join(sv, "gpg.conf") | ||
} | ||
|
||
uhd, _ := os.UserHomeDir() | ||
return filepath.Join(uhd, ".gnupg", "gpg.conf") | ||
} | ||
|
||
func fileContains(path, needle string) bool { | ||
fh, err := os.Open(path) | ||
if err != nil { | ||
debug.Log("failed to open %q for reading: %s", path, err) | ||
return false | ||
} | ||
defer fh.Close() | ||
|
||
s := bufio.NewScanner(fh) | ||
for s.Scan() { | ||
if strings.Contains(s.Text(), needle) { | ||
return true | ||
} | ||
} | ||
return false | ||
} |