Skip to content

Commit

Permalink
chore: clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
j178 committed Feb 22, 2023
1 parent 806fd0d commit 17f884c
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 11 deletions.
6 changes: 0 additions & 6 deletions cmd/edit.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (

"github.com/spf13/cobra"

"github.com/j178/leetgo/config"
"github.com/j178/leetgo/editor"
"github.com/j178/leetgo/lang"
"github.com/j178/leetgo/leetcode"
Expand All @@ -17,7 +16,6 @@ var editCmd = &cobra.Command{
Aliases: []string{"e"},
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
cfg := config.Get()
c := leetcode.NewClient()
qs, err := leetcode.ParseQID(args[0], c)
if err != nil {
Expand All @@ -26,10 +24,6 @@ var editCmd = &cobra.Command{
if len(qs) > 1 {
return fmt.Errorf("multiple questions found")
}
_, err = lang.GetGenerator(cfg.Code.Lang)
if err != nil {
return err
}
result, err := lang.GeneratePathsOnly(qs[0])
if err != nil {
return err
Expand Down
3 changes: 2 additions & 1 deletion cmd/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ var infoCmd = &cobra.Command{
Args: cobra.MinimumNArgs(1),
Aliases: []string{"i"},
RunE: func(cmd *cobra.Command, args []string) error {
c := leetcode.NewClient()
cred := leetcode.CredentialsFromConfig()
c := leetcode.NewClient(leetcode.WithCredentials(cred))
var questions []*leetcode.QuestionData

for _, qid := range args {
Expand Down
4 changes: 1 addition & 3 deletions cmd/open.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ leetgo open 549
leetgo open w330/`,
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
cred := leetcode.CredentialsFromConfig()
c := leetcode.NewClient(leetcode.WithCredentials(cred))
c := leetcode.NewClient()
qid := args[0]
qs, err := leetcode.ParseQID(qid, c)
if err != nil {
Expand All @@ -29,7 +28,6 @@ leetgo open w330/`,
err = browser.OpenURL(q.Url())
}
}

return err
},
}
2 changes: 1 addition & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
const (
CmdName = "leetgo"
globalConfigFile = "config.yaml"
ProjectConfigFilename = CmdName + ".yaml"
ProjectConfigFilename = "leetgo.yaml"
questionCacheBaseName = "leetcode-questions"
stateFilename = "state.json"
CodeBeginMarker = "@lc code=begin"
Expand Down
1 change: 1 addition & 0 deletions leetcode/cache_json.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (

"github.com/charmbracelet/log"
"github.com/goccy/go-json"

"github.com/j178/leetgo/utils"
)

Expand Down

0 comments on commit 17f884c

Please sign in to comment.