Add Username Function
This commit is contained in:
11
cmd/rofi.go
11
cmd/rofi.go
@@ -4,7 +4,6 @@ Copyright © 2024 Brian Buller <brian@bullercodeworks.com>
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"sort"
|
||||
"strings"
|
||||
@@ -26,7 +25,7 @@ func init() {
|
||||
rootCmd.AddCommand(rofiCmd)
|
||||
}
|
||||
|
||||
func runRofi(cmd *cobra.Command, args []string) error {
|
||||
func runRofi(_ *cobra.Command, args []string) error {
|
||||
var db *models.KeePassDB
|
||||
|
||||
var argIsPw bool
|
||||
@@ -46,9 +45,9 @@ func runRofi(cmd *cobra.Command, args []string) error {
|
||||
db, err = models.NewKeePassDB(viper.GetString("database"), pass)
|
||||
if err != nil {
|
||||
util.RemovePWFile(pwFile)
|
||||
return fmt.Errorf("Error opening DB. Re-enter Master Password:\n%v", err)
|
||||
return fmt.Errorf("error opening db. re-enter master password:\n%w", err)
|
||||
} else if err = util.WritePWFile(pwFile, pass); err != nil {
|
||||
return fmt.Errorf("DB Opened, but failed to persist password: %v", err)
|
||||
return fmt.Errorf("db opened, but failed to persist password: %w", err)
|
||||
}
|
||||
|
||||
var path []string
|
||||
@@ -90,6 +89,7 @@ func runRofi(cmd *cobra.Command, args []string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
/*
|
||||
func runRofiSteps(cmd *cobra.Command, args []string) error {
|
||||
var path []string
|
||||
for i := range args {
|
||||
@@ -122,7 +122,7 @@ func runRofiSteps(cmd *cobra.Command, args []string) error {
|
||||
}
|
||||
list := db.GetGroupsAndEntriesFromRoot(path)
|
||||
if len(list) == 0 {
|
||||
return errors.New("Invalid Path")
|
||||
return errors.New("invalid path")
|
||||
} else if len(list) > 1 {
|
||||
for i := range list {
|
||||
fmt.Println(strings.Join(list[i], "/"))
|
||||
@@ -139,3 +139,4 @@ func runRofiSteps(cmd *cobra.Command, args []string) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user