Skip to content

Commit

Permalink
Tidyup codes (#10)
Browse files Browse the repository at this point in the history
* Add Code Spell Checker

* fix typo(LIst -> List)

* Fix literal warning
  • Loading branch information
corrupt952 authored Nov 7, 2021
1 parent f6bcac9 commit 36f7d56
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 18 deletions.
6 changes: 5 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,14 @@
"go.gocodeAutoBuild": true,
"go.formatTool": "gofmt",
"go.useLanguageServer": true,
"cSpell.words": [
"tmuxist"
],
},
"extensions": [
"golang.go",
"editorconfig.editorconfig",
"esbenp.prettier-vscode"
"esbenp.prettier-vscode",
"streetsidesoftware.code-spell-checker"
],
}
2 changes: 1 addition & 1 deletion command/attach.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func (cmd *AttachCommand) Execute(_ context.Context, f *flag.FlagSet, _ ...inter
return subcommands.ExitFailure
}

r := renderer.AttachRenderer{c}
r := renderer.AttachRenderer{Config: c}
if err := shell_helper.Exec(r.Render()); err != nil {
logger.Err(err.Error())
return subcommands.ExitFailure
Expand Down
2 changes: 1 addition & 1 deletion command/kill.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func (cmd *KillCommand) Execute(_ context.Context, f *flag.FlagSet, _ ...interfa
return subcommands.ExitFailure
}

r := renderer.KillRenderer{c}
r := renderer.KillRenderer{Config: c}
if err := shell_helper.Exec(r.Render()); err != nil {
logger.Err(err.Error())
return subcommands.ExitFailure
Expand Down
22 changes: 11 additions & 11 deletions command/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,30 @@ import (
"github.com/google/subcommands"
)

// LIstCommand represents a version command.
type LIstCommand struct{}
// ListCommand represents a version command.
type ListCommand struct{}

// Name returns the name of LIstCommand.
func (*LIstCommand) Name() string {
// Name returns the name of ListCommand.
func (*ListCommand) Name() string {
return "list"
}

// Synopsis returns a short string describing LIstCommand.
func (*LIstCommand) Synopsis() string {
// Synopsis returns a short string describing ListCommand.
func (*ListCommand) Synopsis() string {
return "List tmuxist profiles"
}

// Usage returns a long string explaining LIstCommand and givinig usage.
func (*LIstCommand) Usage() string {
// Usage returns a long string explaining ListCommand and givinig usage.
func (*ListCommand) Usage() string {
return "list: show tmuxist profiles\n"
}

// SetFlags adds the flags for LIstCommand to the specified set.
func (*LIstCommand) SetFlags(f *flag.FlagSet) {
// SetFlags adds the flags for ListCommand to the specified set.
func (*ListCommand) SetFlags(f *flag.FlagSet) {
}

// Execute executes print version and returns an ExitStatus.
func (*LIstCommand) Execute(_ context.Context, f *flag.FlagSet, _ ...interface{}) subcommands.ExitStatus {
func (*ListCommand) Execute(_ context.Context, f *flag.FlagSet, _ ...interface{}) subcommands.ExitStatus {
path, err := config.ConfigurationDirectoryPath()
if err != nil {
logger.Err(err.Error())
Expand Down
4 changes: 2 additions & 2 deletions command/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"tmuxist/config"
shell_helper "tmuxist/helper/shell"
"tmuxist/logger"
"tmuxist/renderer"
renderer "tmuxist/renderer"
)

// StartCommand represents a startup tmux session command.
Expand Down Expand Up @@ -56,7 +56,7 @@ func (cmd *StartCommand) Execute(_ context.Context, f *flag.FlagSet, _ ...interf
return subcommands.ExitFailure
}

r := renderer.StartRenderer{c}
r := renderer.StartRenderer{Config: c}
if err := shell_helper.Exec(r.Render()); err != nil {
logger.Err(err.Error())
return subcommands.ExitFailure
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
func main() {
logger.Setup(os.Stderr)

subcommands.Register(&command.LIstCommand{}, "")
subcommands.Register(&command.ListCommand{}, "")
subcommands.Register(&command.InitCommand{}, "")
subcommands.Register(&command.EditCommand{}, "")
subcommands.Register(&command.PrintCommand{}, "")
Expand Down
2 changes: 1 addition & 1 deletion renderer/start_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ cd ~
echo "hoge"
`
p := config.Pane{command}
p := config.Pane{Command: command}

actual := r.renderPane(&p, true)
expected := `PANE_NO=$WINDOW_NO
Expand Down

0 comments on commit 36f7d56

Please sign in to comment.