Skip to content

Commit

Permalink
Merge pull request #2 from gesellix/windows
Browse files Browse the repository at this point in the history
Improve Windows compatibility, improve convenience for "copy"
  • Loading branch information
tobischo authored Apr 20, 2024
2 parents 0432c91 + 4ff2c61 commit d32fb31
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions copy.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ func copyCmd(cmd *cobra.Command, args []string) error {

markAsAccessed(entry)

fmt.Printf("URL: %s\n", entry.GetContent("URL"))
fmt.Printf("UserName: %s\n", entry.GetContent("UserName"))

return nil
Expand Down
4 changes: 4 additions & 0 deletions entries.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ func readEntry(selection string, g *gokeepasslib.Group) (*gokeepasslib.Entry, er
return nil, fmt.Errorf("No entry found")
}

if len(entries) == 1 {
return readEntry(entries[0], g)
}

for i, entry := range entries {
fmt.Printf("%3d %s\n", i, entry)
}
Expand Down
3 changes: 2 additions & 1 deletion helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"fmt"
"syscall"

"github.com/tobischo/gokeepasslib/v3"
"golang.org/x/crypto/ssh/terminal"
Expand All @@ -18,7 +19,7 @@ func readString(text string) (string, error) {

func readPassword(text string) (string, error) {
fmt.Print(text)
pw, err := terminal.ReadPassword(0)
pw, err := terminal.ReadPassword(int(syscall.Stdin))
if err != nil {
return "", fmt.Errorf("Failed to read password: '%s'", err)
}
Expand Down

0 comments on commit d32fb31

Please sign in to comment.