Skip to content
This repository was archived by the owner on Nov 9, 2019. It is now read-only.

Commit 60ac018

Browse files
authored
Merge pull request #33 from leonklingele/move-commands-to-package
Move commands to 'commands' package
2 parents b64dbf9 + 7763afe commit 60ac018

File tree

8 files changed

+20
-19
lines changed

8 files changed

+20
-19
lines changed

add.go renamed to commands/add.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package main
1+
package commands
22

33
import (
44
"fmt"
@@ -11,7 +11,7 @@ const (
1111
passwordLength = 25
1212
)
1313

14-
func addCommand(args ...string) int {
14+
func AddCommand(args ...string) int {
1515
safe, err := loadSafe()
1616
if err != nil {
1717
return handleError(err)

cat.go renamed to commands/cat.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
package main
1+
package commands
22

33
import (
44
"fmt"
55

66
"github.com/bndw/pick/utils"
77
)
88

9-
func catCommand(args ...string) int {
9+
func CatCommand(args ...string) int {
1010
safe, err := loadSafe()
1111
if err != nil {
1212
return handleError(err)

copy.go renamed to commands/copy.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
package main
1+
package commands
22

3-
func copyCommand(args ...string) int {
3+
func CopyCommand(args ...string) int {
44
safe, err := loadSafe()
55
if err != nil {
66
return handleError(err)

export.go renamed to commands/export.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
package main
1+
package commands
22

33
import (
44
"fmt"
55

66
"github.com/bndw/pick/utils"
77
)
88

9-
func exportCommand(args ...string) int {
9+
func ExportCommand(args ...string) int {
1010
safe, err := loadSafe()
1111
if err != nil {
1212
return handleError(err)

list.go renamed to commands/list.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
package main
1+
package commands
22

33
import (
44
"fmt"
55
"sort"
66
)
77

8-
func listCommand(args ...string) int {
8+
func ListCommand(args ...string) int {
99
safe, err := loadSafe()
1010
if err != nil {
1111
return handleError(err)

remove.go renamed to commands/remove.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
package main
1+
package commands
22

33
import "fmt"
44

5-
func removeCommand(args ...string) int {
5+
func RemoveCommand(args ...string) int {
66
safe, err := loadSafe()
77
if err != nil {
88
return handleError(err)

util.go renamed to commands/util.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package main
1+
package commands
22

33
import (
44
"fmt"

main.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"fmt"
55
"os"
66

7+
"github.com/bndw/pick/commands"
78
"github.com/spf13/cobra"
89
)
910

@@ -13,7 +14,7 @@ var cmdAdd = &cobra.Command{
1314
Long: `The add command is used to add a new credential.
1415
`,
1516
Run: func(cmd *cobra.Command, args []string) {
16-
os.Exit(addCommand(args...))
17+
os.Exit(commands.AddCommand(args...))
1718
},
1819
}
1920

@@ -28,7 +29,7 @@ var cmdCat = &cobra.Command{
2829
os.Exit(1)
2930
}
3031

31-
os.Exit(catCommand(args...))
32+
os.Exit(commands.CatCommand(args...))
3233
},
3334
}
3435

@@ -44,7 +45,7 @@ to the clipboard.
4445
os.Exit(1)
4546
}
4647

47-
os.Exit(copyCommand(args...))
48+
os.Exit(commands.CopyCommand(args...))
4849
},
4950
}
5051

@@ -55,7 +56,7 @@ var cmdExport = &cobra.Command{
5556
format.
5657
`,
5758
Run: func(cmd *cobra.Command, args []string) {
58-
os.Exit(exportCommand(args...))
59+
os.Exit(commands.ExportCommand(args...))
5960
},
6061
}
6162

@@ -65,7 +66,7 @@ var cmdList = &cobra.Command{
6566
Long: `The list command is used to list the saved credentials.
6667
`,
6768
Run: func(cmd *cobra.Command, args []string) {
68-
os.Exit(listCommand(args...))
69+
os.Exit(commands.ListCommand(args...))
6970
},
7071
}
7172

@@ -75,7 +76,7 @@ var cmdRemove = &cobra.Command{
7576
Long: `The remove command is used to remove a saved credential.
7677
`,
7778
Run: func(cmd *cobra.Command, args []string) {
78-
os.Exit(removeCommand(args...))
79+
os.Exit(commands.RemoveCommand(args...))
7980
},
8081
}
8182

0 commit comments

Comments
 (0)