mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-02-03 13:21:56 +02:00
Bump github.com/fsmiamoto/git-todo-parser to latest main version
This commit is contained in:
parent
981ba4c66c
commit
62c5c32fbb
2
go.mod
2
go.mod
@ -9,7 +9,7 @@ require (
|
||||
github.com/cli/safeexec v1.0.0
|
||||
github.com/cloudfoundry/jibber_jabber v0.0.0-20151120183258-bcc4c8345a21
|
||||
github.com/creack/pty v1.1.11
|
||||
github.com/fsmiamoto/git-todo-parser v0.0.2
|
||||
github.com/fsmiamoto/git-todo-parser v0.0.4-0.20230403011024-617a5a7ce980
|
||||
github.com/fsnotify/fsnotify v1.4.7
|
||||
github.com/gdamore/tcell/v2 v2.6.0
|
||||
github.com/go-errors/errors v1.4.2
|
||||
|
4
go.sum
4
go.sum
@ -28,8 +28,8 @@ github.com/fatih/color v1.7.1-0.20180516100307-2d684516a886/go.mod h1:Zm6kSWBoL9
|
||||
github.com/fatih/color v1.9.0 h1:8xPHl4/q1VyqGIPif1F+1V3Y3lSmrq01EabUW3CoW5s=
|
||||
github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU=
|
||||
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc=
|
||||
github.com/fsmiamoto/git-todo-parser v0.0.2 h1:l6Y+9q7jbM+yK/w6kASpHO7ejL9ARCErm3tCEqOT278=
|
||||
github.com/fsmiamoto/git-todo-parser v0.0.2/go.mod h1:B+AgTbNE2BARvJqzXygThzqxLIaEWvwr2sxKYYb0Fas=
|
||||
github.com/fsmiamoto/git-todo-parser v0.0.4-0.20230403011024-617a5a7ce980 h1:ay9aM+Ay9I4LJttUVF4EFVmeNUkS9/snYVFK6lwieVQ=
|
||||
github.com/fsmiamoto/git-todo-parser v0.0.4-0.20230403011024-617a5a7ce980/go.mod h1:B+AgTbNE2BARvJqzXygThzqxLIaEWvwr2sxKYYb0Fas=
|
||||
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
|
||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||
github.com/gdamore/encoding v1.0.0 h1:+7OoQ1Bc6eTm5niUzBa0Ctsh6JbMW6Ra+YNuAtDBdko=
|
||||
|
7
vendor/github.com/fsmiamoto/git-todo-parser/LICENSE
generated
vendored
Normal file
7
vendor/github.com/fsmiamoto/git-todo-parser/LICENSE
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
Copyright © 2023 Flavio Miamoto
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
15
vendor/github.com/fsmiamoto/git-todo-parser/todo/parse.go
generated
vendored
15
vendor/github.com/fsmiamoto/git-todo-parser/todo/parse.go
generated
vendored
@ -13,6 +13,7 @@ var (
|
||||
ErrMissingLabel = errors.New("missing label")
|
||||
ErrMissingCommit = errors.New("missing commit")
|
||||
ErrMissingExecCmd = errors.New("missing command for exec")
|
||||
ErrMissingRef = errors.New("missing ref")
|
||||
)
|
||||
|
||||
func Parse(f io.Reader) ([]Todo, error) {
|
||||
@ -55,9 +56,9 @@ func parseLine(line string) (Todo, error) {
|
||||
|
||||
fields := strings.Fields(line)
|
||||
|
||||
for i := TodoCommand(Pick); i < Comment; i++ {
|
||||
for i := Pick; i < Comment; i++ {
|
||||
if isCommand(i, fields[0]) {
|
||||
todo.Command = TodoCommand(i)
|
||||
todo.Command = i
|
||||
fields = fields[1:]
|
||||
break
|
||||
}
|
||||
@ -90,6 +91,7 @@ func parseLine(line string) (Todo, error) {
|
||||
|
||||
if todo.Command == Merge {
|
||||
if fields[0] == "-C" || fields[0] == "-c" {
|
||||
todo.Flag = fields[0]
|
||||
fields = fields[1:]
|
||||
if len(fields) == 0 {
|
||||
return todo, ErrMissingCommit
|
||||
@ -115,10 +117,19 @@ func parseLine(line string) (Todo, error) {
|
||||
}
|
||||
// Skip flags
|
||||
if fields[0] == "-C" || fields[0] == "-c" {
|
||||
todo.Flag = fields[0]
|
||||
fields = fields[1:]
|
||||
}
|
||||
}
|
||||
|
||||
if todo.Command == UpdateRef {
|
||||
if len(fields) == 0 {
|
||||
return todo, ErrMissingRef
|
||||
}
|
||||
todo.Ref = fields[0]
|
||||
return todo, nil
|
||||
}
|
||||
|
||||
if len(fields) == 0 {
|
||||
return todo, ErrMissingCommit
|
||||
}
|
||||
|
7
vendor/github.com/fsmiamoto/git-todo-parser/todo/todo.go
generated
vendored
7
vendor/github.com/fsmiamoto/git-todo-parser/todo/todo.go
generated
vendored
@ -18,6 +18,7 @@ const (
|
||||
|
||||
NoOp
|
||||
Drop
|
||||
UpdateRef
|
||||
|
||||
Comment
|
||||
)
|
||||
@ -27,10 +28,12 @@ const CommentChar = "#"
|
||||
type Todo struct {
|
||||
Command TodoCommand
|
||||
Commit string
|
||||
Flag string
|
||||
Comment string
|
||||
ExecCommand string
|
||||
Label string
|
||||
Msg string
|
||||
Ref string
|
||||
}
|
||||
|
||||
func (t TodoCommand) String() string {
|
||||
@ -51,10 +54,11 @@ var commandToString = map[TodoCommand]string{
|
||||
Merge: "merge",
|
||||
NoOp: "noop",
|
||||
Drop: "drop",
|
||||
UpdateRef: "update-ref",
|
||||
Comment: "comment",
|
||||
}
|
||||
|
||||
var todoCommandInfo = [14]struct {
|
||||
var todoCommandInfo = [15]struct {
|
||||
nickname string
|
||||
cmd string
|
||||
}{
|
||||
@ -72,4 +76,5 @@ var todoCommandInfo = [14]struct {
|
||||
{"m", "merge"},
|
||||
{"", "noop"},
|
||||
{"d", "drop"},
|
||||
{"u", "update-ref"},
|
||||
}
|
||||
|
92
vendor/github.com/fsmiamoto/git-todo-parser/todo/write.go
generated
vendored
Normal file
92
vendor/github.com/fsmiamoto/git-todo-parser/todo/write.go
generated
vendored
Normal file
@ -0,0 +1,92 @@
|
||||
package todo
|
||||
|
||||
import (
|
||||
"io"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func Write(f io.Writer, todos []Todo) error {
|
||||
for _, todo := range todos {
|
||||
if err := writeTodo(f, todo); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func writeTodo(f io.Writer, todo Todo) error {
|
||||
var sb strings.Builder
|
||||
if todo.Command != Comment {
|
||||
sb.WriteString(todo.Command.String())
|
||||
}
|
||||
|
||||
switch todo.Command {
|
||||
case NoOp:
|
||||
return nil
|
||||
|
||||
case Comment:
|
||||
sb.WriteString(CommentChar)
|
||||
sb.WriteString(todo.Comment)
|
||||
|
||||
case Break:
|
||||
|
||||
case Label:
|
||||
fallthrough
|
||||
case Reset:
|
||||
sb.WriteByte(' ')
|
||||
sb.WriteString(todo.Label)
|
||||
|
||||
case Exec:
|
||||
sb.WriteByte(' ')
|
||||
sb.WriteString(todo.ExecCommand)
|
||||
|
||||
case Merge:
|
||||
sb.WriteByte(' ')
|
||||
if todo.Commit != "" {
|
||||
sb.WriteString(todo.Flag)
|
||||
sb.WriteByte(' ')
|
||||
sb.WriteString(todo.Commit)
|
||||
sb.WriteByte(' ')
|
||||
}
|
||||
sb.WriteString(todo.Label)
|
||||
if todo.Msg != "" {
|
||||
sb.WriteString(" # ")
|
||||
sb.WriteString(todo.Msg)
|
||||
}
|
||||
|
||||
case Fixup:
|
||||
sb.WriteByte(' ')
|
||||
if todo.Flag != "" {
|
||||
sb.WriteString(todo.Flag)
|
||||
sb.WriteByte(' ')
|
||||
}
|
||||
sb.WriteString(todo.Commit)
|
||||
|
||||
case UpdateRef:
|
||||
sb.WriteByte(' ')
|
||||
sb.WriteString(todo.Ref)
|
||||
|
||||
case Pick:
|
||||
fallthrough
|
||||
case Revert:
|
||||
fallthrough
|
||||
case Edit:
|
||||
fallthrough
|
||||
case Reword:
|
||||
fallthrough
|
||||
case Squash:
|
||||
fallthrough
|
||||
case Drop:
|
||||
sb.WriteByte(' ')
|
||||
sb.WriteString(todo.Commit)
|
||||
if todo.Msg != "" {
|
||||
sb.WriteByte(' ')
|
||||
sb.WriteString(todo.Msg)
|
||||
}
|
||||
}
|
||||
|
||||
sb.WriteByte('\n')
|
||||
_, err := f.Write([]byte(sb.String()))
|
||||
return err
|
||||
}
|
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
@ -30,7 +30,7 @@ github.com/emirpasic/gods/utils
|
||||
# github.com/fatih/color v1.9.0
|
||||
## explicit; go 1.13
|
||||
github.com/fatih/color
|
||||
# github.com/fsmiamoto/git-todo-parser v0.0.2
|
||||
# github.com/fsmiamoto/git-todo-parser v0.0.4-0.20230403011024-617a5a7ce980
|
||||
## explicit; go 1.13
|
||||
github.com/fsmiamoto/git-todo-parser/todo
|
||||
# github.com/fsnotify/fsnotify v1.4.7
|
||||
|
Loading…
x
Reference in New Issue
Block a user