HidemaruOwO / pummit

Create good commit message in CLI
MIT License
20 stars 1 forks source link

:bug: alias addとdeleteが動作しない #16

Closed HidemaruOwO closed 1 year ago

HidemaruOwO commented 1 year ago

機能名及び動作

alias add | alias delete

再現方法

$ pummit alias add unko tada
[WARN] Missing alias
$ pummit alias delete b
panic: runtime error: slice bounds out of range [2:1]

goroutine 1 [running]:
github.com/HidemaruOwO/pummit/pummit/cmd/alias.aliasDelete({0xc00007de50, 0x1, 0x1})
        /home/hidemaru/Code/pummit/pummit/cmd/alias/delete.go:23 +0x306
github.com/HidemaruOwO/pummit/pummit/cmd/alias.AliasDeleteCmd(...)
        /home/hidemaru/Code/pummit/pummit/cmd/alias/delete.go:12
main.main.func3(0xc000197868?)
        /home/hidemaru/Code/pummit/pummit/pummit.go:60 +0x45
github.com/urfave/cli/v2.(*Command).Run(0xc0001c62c0, 0xc0000169c0, {0xc00007ec00, 0x2, 0x2})
        /home/hidemaru/go/pkg/mod/github.com/urfave/cli/v2@v2.25.0/command.go:273 +0x9eb
github.com/urfave/cli/v2.(*Command).Run(0xc0001c6000, 0xc000016840, {0xc0000a74d0, 0x3, 0x3})
        /home/hidemaru/go/pkg/mod/github.com/urfave/cli/v2@v2.25.0/command.go:266 +0xc4d
github.com/urfave/cli/v2.(*Command).Run(0xc0001c69a0, 0xc000016700, {0xc000016080, 0x4, 0x4})
        /home/hidemaru/go/pkg/mod/github.com/urfave/cli/v2@v2.25.0/command.go:266 +0xc4d
github.com/urfave/cli/v2.(*App).RunContext(0xc0001c4000, {0x763298?, 0xc000020068}, {0xc000016080, 0x4, 0x4})
        /home/hidemaru/go/pkg/mod/github.com/urfave/cli/v2@v2.25.0/app.go:332 +0x616
github.com/urfave/cli/v2.(*App).Run(...)
        /home/hidemaru/go/pkg/mod/github.com/urfave/cli/v2@v2.25.0/app.go:309
main.main()
        /home/hidemaru/Code/pummit/pummit/pummit.go:117 +0x736

$ pummit alias delete b r
[WARN] The alias name to be deleted must be added as the third argument

詳細な情報

config.jsonにはしっかり絵文字エイリアスが存在している

その他

No response

HidemaruOwO commented 1 year ago

希望通りに動かないのは与えるargsが足りないため。

https://github.com/HidemaruOwO/pummit/blob/73ecc9aae3a53428c395285188119f9865ae8425/pummit/cmd/alias/add.go#L31..L32

ここをこのように直せば直る

alias := [0]
prefix := [1]
HidemaruOwO commented 1 year ago

deleteも同じぽい

HidemaruOwO commented 1 year ago

引数を指定しないとバグる問題は横着して.Slice()を使ってたからっぽい

Comamoca commented 1 year ago

のコマンドのコマンドの、

を修正しました。

HidemaruOwO commented 1 year ago

領海です。PR通します。