Skip to content
Permalink
Browse files

Add xw to copy entry url

  • Loading branch information...
Raggaer committed Feb 21, 2019
1 parent 1dacbce commit 24a6526bd1fa31def8a1b057c8681b156a023f2b
Showing with 30 additions and 9 deletions.
  1. +3 −2 README.md
  2. +13 −4 command.go
  3. +12 −1 entry.go
  4. +2 −2 group.go
@@ -13,12 +13,13 @@ You can use the `help` command while a database is opened to view the list of co

- `xp` Copies the password of an entry
- `xu` Copies the username of an entry
- `xw` Copies the URL (www) of an entry
- `ls` Lists all the groups and entries of the current group
- `cd` Changes the current working group
- `exit` Closes the application
- `save` Saves the database
- `ng` Shows and processes a form to create a new group
- `ne` Shows and processes a form to create a new entry
- `mkdir` Shows and processes a form to create a new group
- `new` Shows and processes a form to create a new entry
- `rm` Removes an entry from the current working group
- `show` Shows an entry from the current working group
- `search` Searches entries from the current working group
@@ -40,7 +40,6 @@ var commands = []command{
Help: "Shows an entry (show <entry name|number>)",
HelpSmall: "Shows an entry (show <entry name|number>)",
},

{
Key: "xp",
Fn: func(args []string) {
@@ -51,6 +50,16 @@ var commands = []command{
Help: "Copies an entry password (xp <entry name|number>)",
HelpSmall: "Copies an entry password (xp <entry name|number>)",
},
{
Key: "xw",
Fn: func(args []string) {
if len(args) >= 1 {
xw(args)
}
},
Help: "Copies an entry URL (xw <entry name|number>)",
HelpSmall: "Copies an entry URL (xw <entry name|number>)",
},
{
Key: "xu",
Fn: func(args []string) {
@@ -62,13 +71,13 @@ var commands = []command{
HelpSmall: "Copies an entry username (xu <entry name|number>)",
},
{
Key: "ng",
Fn: ng,
Key: "mkdir",
Fn: mkdir,
Help: "Creates a new group inside the current group",
HelpSmall: "Creates a new group inside the current group",
},
{
Key: "ne",
Key: "new",
Fn: ne,
Help: "Creates a new entry inside the current group",
HelpSmall: "Creates a new entry inside the current group",
@@ -120,7 +120,7 @@ func rm(args []string) {
}
}

// Command "ne" starts a new entry form
// Command "new" starts a new entry form
func ne(args []string) {
fmt.Print("- Entry username: ")
activeForm = &form{
@@ -192,6 +192,17 @@ func xp(args []string) {
fmt.Printf("Copied entry '%s' password to clipboard\r\n", e.GetTitle())
}

// Command "xw" copies an entry URL
func xp(args []string) {
entry := args[0]
e := getEntryByNameOrId(entry)
if e == nil {
return
}
clipboard.WriteAll(e.GetContent("URL"))
fmt.Printf("Copied entry '%s' URL to clipboard\r\n", e.GetTitle())
}

// Command "xu" copies an entry username
func xu(args []string) {
entry := args[0]
@@ -11,8 +11,8 @@ type newGroupForm struct {
Notes string
}

// Command "ng" starts a new group form
func ng(args []string) {
// Command "mkdir" starts a new group form
func mkdir(args []string) {
fmt.Print("- Group name: ")
activeForm = &form{
Fn: createNewGroup,

0 comments on commit 24a6526

Please sign in to comment.
You can’t perform that action at this time.