Skip to content

Commit

Permalink
♻️ test: implement Cmd interface
Browse files Browse the repository at this point in the history
  • Loading branch information
budougumi0617 committed Sep 28, 2020
1 parent 3c3318e commit 4e81999
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ var _ Cmd = &GenerateCmd{}
type GenerateCmd struct{}

func (g *GenerateCmd) MaxArg() int {
return 2
return 1
}

func (g *GenerateCmd) Usage() string {
Expand Down
19 changes: 18 additions & 1 deletion test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,26 @@ import (
"fmt"
"io/ioutil"
"os"
"strconv"
)

func TestCmd(ctx context.Context, id int) error {
var _ Cmd = &TestCmd{}

type TestCmd struct{}

func (c *TestCmd) MaxArg() int {
return 1
}

func (c *TestCmd) Usage() string {
return "submit codes and "
}

func (c *TestCmd) Run(ctx context.Context, args []string) error {
id, err := strconv.Atoi(args[0])
if err != nil {
return err
}
session := os.Getenv("LEETCODE_SESSION")
token := os.Getenv("LEETCODE_TOKEN")

Expand Down

0 comments on commit 4e81999

Please sign in to comment.