From 337e57afbb32057a96c978b7f6d74ff1aa213b28 Mon Sep 17 00:00:00 2001 From: Gustavo Andrioli Date: Mon, 10 Oct 2022 18:29:17 -0300 Subject: [PATCH] Bump lazycore --- go.mod | 5 +-- go.sum | 6 +-- pkg/cheatsheet/validate.go | 4 +- .../golang-collections/collections/LICENSE | 20 --------- .../collections/stack/stack.go | 44 ------------------- .../jesseduffield/lazycore/pkg/utils/utils.go | 35 +++++++++++++++ vendor/modules.txt | 3 +- 7 files changed, 42 insertions(+), 75 deletions(-) delete mode 100644 vendor/github.com/golang-collections/collections/LICENSE delete mode 100644 vendor/github.com/golang-collections/collections/stack/stack.go diff --git a/go.mod b/go.mod index b8a9dcd7..84730748 100644 --- a/go.mod +++ b/go.mod @@ -9,18 +9,18 @@ require ( github.com/docker/docker v20.10.15+incompatible github.com/fatih/color v1.7.0 github.com/go-errors/errors v1.4.2 - github.com/golang-collections/collections v0.0.0-20130729185459-604e922904d3 github.com/gookit/color v1.5.0 github.com/imdario/mergo v0.3.8 github.com/integrii/flaggy v1.4.0 github.com/jesseduffield/asciigraph v0.0.0-20190605104717-6d88e39309ee github.com/jesseduffield/gocui v0.3.1-0.20220417002912-bce22fd599f6 github.com/jesseduffield/kill v0.0.0-20220618033138-bfbe04675d10 - github.com/jesseduffield/lazycore v0.0.0-20221009164442-17c8b878c316 + github.com/jesseduffield/lazycore v0.0.0-20221010211550-2c30efd18b93 github.com/jesseduffield/yaml v0.0.0-20190702115811-b900b7e08b56 github.com/mattn/go-runewidth v0.0.13 github.com/mcuadros/go-lookup v0.0.0-20171110082742-5650f26be767 github.com/mgutz/str v1.2.0 + github.com/pmezard/go-difflib v1.0.0 github.com/samber/lo v1.31.0 github.com/sirupsen/logrus v1.4.2 github.com/spkg/bom v0.0.0-20160624110644-59b7046e48ad @@ -48,7 +48,6 @@ require ( github.com/opencontainers/go-digest v1.0.0-rc1 // indirect github.com/opencontainers/image-spec v1.0.1 // indirect github.com/pkg/errors v0.9.1 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rivo/uniseg v0.2.0 // indirect github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 // indirect golang.org/x/exp v0.0.0-20220428152302-39d4317da171 // indirect diff --git a/go.sum b/go.sum index 7daa24f7..05c3753c 100644 --- a/go.sum +++ b/go.sum @@ -33,8 +33,6 @@ github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxI github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og= github.com/gogo/protobuf v1.3.1 h1:DqDEcV5aeaTmdFBePNpYsp3FlcVH/2ISVVM9Qf8PSls= github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= -github.com/golang-collections/collections v0.0.0-20130729185459-604e922904d3 h1:zN2lZNZRflqFyxVaTIU61KNKQ9C0055u9CAfpmqUvo4= -github.com/golang-collections/collections v0.0.0-20130729185459-604e922904d3/go.mod h1:nPpo7qLxd6XL3hWJG/O60sR8ZKfMCiIoNap5GvD12KU= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= @@ -54,8 +52,8 @@ github.com/jesseduffield/gocui v0.3.1-0.20220417002912-bce22fd599f6 h1:Fmay0Lz21 github.com/jesseduffield/gocui v0.3.1-0.20220417002912-bce22fd599f6/go.mod h1:znJuCDnF2Ph40YZSlBwdX/4GEofnIoWLGdT4mK5zRAU= github.com/jesseduffield/kill v0.0.0-20220618033138-bfbe04675d10 h1:jmpr7KpX2+2GRiE91zTgfq49QvgiqB0nbmlwZ8UnOx0= github.com/jesseduffield/kill v0.0.0-20220618033138-bfbe04675d10/go.mod h1:aA97kHeNA+sj2Hbki0pvLslmE4CbDyhBeSSTUUnOuVo= -github.com/jesseduffield/lazycore v0.0.0-20221009164442-17c8b878c316 h1:UzTg0utG+cLS94Qjb/ZFDzfMeZDFXErSbNgJOyj70EA= -github.com/jesseduffield/lazycore v0.0.0-20221009164442-17c8b878c316/go.mod h1:qxN4mHOAyeIDLP7IK7defgPClM/z1Kze8VVQiaEjzsQ= +github.com/jesseduffield/lazycore v0.0.0-20221010211550-2c30efd18b93 h1:zY7ymCjXC7fZeJVXDpiicYx6c2YFgvsdZSOdch2f7gU= +github.com/jesseduffield/lazycore v0.0.0-20221010211550-2c30efd18b93/go.mod h1:qxN4mHOAyeIDLP7IK7defgPClM/z1Kze8VVQiaEjzsQ= github.com/jesseduffield/yaml v0.0.0-20190702115811-b900b7e08b56 h1:33wSxJWU/f2TAozHYtJ8zqBxEnEVYM+22moLoiAkxvg= github.com/jesseduffield/yaml v0.0.0-20190702115811-b900b7e08b56/go.mod h1:FZJBwOhE+RXz8EVZfY+xnbCw2cVOwxlK3/aIi581z/s= github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= diff --git a/pkg/cheatsheet/validate.go b/pkg/cheatsheet/validate.go index 1ad33681..033c7def 100644 --- a/pkg/cheatsheet/validate.go +++ b/pkg/cheatsheet/validate.go @@ -8,7 +8,7 @@ import ( "path/filepath" "regexp" - "github.com/jesseduffield/lazydocker/pkg/utils" + "github.com/jesseduffield/lazycore/pkg/utils" "github.com/pmezard/go-difflib/difflib" ) @@ -60,7 +60,7 @@ func Check() { } func GetKeybindingsDir() string { - return utils.GetLazydockerRootDirectory() + "/docs/keybindings" + return utils.GetLazyRootDirectory() + "/docs/keybindings" } func obtainContent(dir string) string { diff --git a/vendor/github.com/golang-collections/collections/LICENSE b/vendor/github.com/golang-collections/collections/LICENSE deleted file mode 100644 index 863a984d..00000000 --- a/vendor/github.com/golang-collections/collections/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (c) 2012 Caleb Doxsey - -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. \ No newline at end of file diff --git a/vendor/github.com/golang-collections/collections/stack/stack.go b/vendor/github.com/golang-collections/collections/stack/stack.go deleted file mode 100644 index 11f472a9..00000000 --- a/vendor/github.com/golang-collections/collections/stack/stack.go +++ /dev/null @@ -1,44 +0,0 @@ -package stack - -type ( - Stack struct { - top *node - length int - } - node struct { - value interface{} - prev *node - } -) -// Create a new stack -func New() *Stack { - return &Stack{nil,0} -} -// Return the number of items in the stack -func (this *Stack) Len() int { - return this.length -} -// View the top item on the stack -func (this *Stack) Peek() interface{} { - if this.length == 0 { - return nil - } - return this.top.value -} -// Pop the top item of the stack and return it -func (this *Stack) Pop() interface{} { - if this.length == 0 { - return nil - } - - n := this.top - this.top = n.prev - this.length-- - return n.value -} -// Push a value onto the top of the stack -func (this *Stack) Push(value interface{}) { - n := &node{value,this.top} - this.top = n - this.length++ -} \ No newline at end of file diff --git a/vendor/github.com/jesseduffield/lazycore/pkg/utils/utils.go b/vendor/github.com/jesseduffield/lazycore/pkg/utils/utils.go index 9fa93376..9d0c2cc6 100644 --- a/vendor/github.com/jesseduffield/lazycore/pkg/utils/utils.go +++ b/vendor/github.com/jesseduffield/lazycore/pkg/utils/utils.go @@ -1,5 +1,11 @@ package utils +import ( + "log" + "os" + "path/filepath" +) + // Min returns the minimum of two integers func Min(x, y int) int { if x < y { @@ -8,9 +14,38 @@ func Min(x, y int) int { return y } +// Max returns the maximum of two integers func Max(x, y int) int { if x > y { return x } return y } + +// GetLazyRootDirectory finds a lazy project root directory. +// +// It's used for cheatsheet scripts and integration tests. Not to be confused with finding the +// root directory of _any_ random repo. +func GetLazyRootDirectory() string { + path, err := os.Getwd() + if err != nil { + panic(err) + } + + for { + _, err := os.Stat(filepath.Join(path, ".git")) + if err == nil { + return path + } + + if !os.IsNotExist(err) { + panic(err) + } + + path = filepath.Dir(path) + + if path == "/" { + log.Fatal("must run in lazy project folder or child folder") + } + } +} diff --git a/vendor/modules.txt b/vendor/modules.txt index a8818516..400209c5 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -102,7 +102,6 @@ github.com/go-errors/errors github.com/gogo/protobuf/proto # github.com/golang-collections/collections v0.0.0-20130729185459-604e922904d3 ## explicit -github.com/golang-collections/collections/stack # github.com/gookit/color v1.5.0 ## explicit; go 1.13 github.com/gookit/color @@ -121,7 +120,7 @@ github.com/jesseduffield/gocui # github.com/jesseduffield/kill v0.0.0-20220618033138-bfbe04675d10 ## explicit; go 1.18 github.com/jesseduffield/kill -# github.com/jesseduffield/lazycore v0.0.0-20221009164442-17c8b878c316 +# github.com/jesseduffield/lazycore v0.0.0-20221010211550-2c30efd18b93 ## explicit; go 1.18 github.com/jesseduffield/lazycore/pkg/boxlayout github.com/jesseduffield/lazycore/pkg/utils