Merge branch 'main' of ssh://git.bullercodeworks.com:2200/brian/keepass-cli
This commit is contained in:
commit
e8bf42dd17
52
cmd/rofi.go
52
cmd/rofi.go
@ -88,55 +88,3 @@ func runRofi(_ *cobra.Command, args []string) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
/*
|
||||
func runRofiSteps(cmd *cobra.Command, args []string) error {
|
||||
var path []string
|
||||
for i := range args {
|
||||
path = append(path, strings.Split(args[i], "/")...)
|
||||
}
|
||||
var db *models.KeePassDB
|
||||
var havePassword bool
|
||||
pwFile := fmt.Sprintf("%s%s", ConfigDir, "pw")
|
||||
pass, err := util.ReadFile(pwFile)
|
||||
if err != nil {
|
||||
havePassword = false
|
||||
// See if we have a password...
|
||||
if len(args) == 1 {
|
||||
pass = args[0]
|
||||
} else {
|
||||
fmt.Println("Enter Master Password")
|
||||
return nil
|
||||
}
|
||||
} else {
|
||||
havePassword = true
|
||||
}
|
||||
db, err = models.NewKeePassDB(viper.GetString("database"), pass)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if !havePassword {
|
||||
if err = util.WritePWFile(pwFile, pass); err != nil {
|
||||
return err
|
||||
}
|
||||
path = []string{}
|
||||
}
|
||||
list := db.GetGroupsAndEntriesFromRoot(path)
|
||||
if len(list) == 0 {
|
||||
return errors.New("invalid path")
|
||||
} else if len(list) > 1 {
|
||||
for i := range list {
|
||||
fmt.Println(strings.Join(list[i], "/"))
|
||||
}
|
||||
} else {
|
||||
// Only one... Could be a single group nested, or it's an entry
|
||||
entry, entryErr := db.FindEntryFromRoot(path)
|
||||
if entryErr == nil {
|
||||
return util.WriteToClipboard(entry.GetPassword())
|
||||
}
|
||||
// It's a group
|
||||
fmt.Println(strings.Join(list[0], "/"))
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user