GoWeb: add container into command
Some checks failed
Test / lic-headers (push) Has been cancelled
Test / golangci-lint (push) Has been cancelled
Test / ${{ matrix.platform }} | 1.${{ matrix.go }}.x (17, macOS) (push) Has been cancelled
Test / ${{ matrix.platform }} | 1.${{ matrix.go }}.x (17, ubuntu) (push) Has been cancelled
Test / ${{ matrix.platform }} | 1.${{ matrix.go }}.x (18, macOS) (push) Has been cancelled
Test / ${{ matrix.platform }} | 1.${{ matrix.go }}.x (18, ubuntu) (push) Has been cancelled
Test / ${{ matrix.platform }} | 1.${{ matrix.go }}.x (19, macOS) (push) Has been cancelled
Test / ${{ matrix.platform }} | 1.${{ matrix.go }}.x (19, ubuntu) (push) Has been cancelled
Test / ${{ matrix.platform }} | 1.${{ matrix.go }}.x (20, macOS) (push) Has been cancelled
Test / ${{ matrix.platform }} | 1.${{ matrix.go }}.x (20, ubuntu) (push) Has been cancelled
Test / ${{ matrix.platform }} | 1.${{ matrix.go }}.x (21, macOS) (push) Has been cancelled
Test / ${{ matrix.platform }} | 1.${{ matrix.go }}.x (21, ubuntu) (push) Has been cancelled
Test / ${{ matrix.platform }} | 1.${{ matrix.go }}.x (22, macOS) (push) Has been cancelled
Test / ${{ matrix.platform }} | 1.${{ matrix.go }}.x (22, ubuntu) (push) Has been cancelled
Test / ${{ matrix.platform }} | 1.${{ matrix.go }}.x (23, macOS) (push) Has been cancelled
Test / ${{ matrix.platform }} | 1.${{ matrix.go }}.x (23, ubuntu) (push) Has been cancelled
Test / MINGW64 (push) Has been cancelled
Some checks failed
Test / lic-headers (push) Has been cancelled
Test / golangci-lint (push) Has been cancelled
Test / ${{ matrix.platform }} | 1.${{ matrix.go }}.x (17, macOS) (push) Has been cancelled
Test / ${{ matrix.platform }} | 1.${{ matrix.go }}.x (17, ubuntu) (push) Has been cancelled
Test / ${{ matrix.platform }} | 1.${{ matrix.go }}.x (18, macOS) (push) Has been cancelled
Test / ${{ matrix.platform }} | 1.${{ matrix.go }}.x (18, ubuntu) (push) Has been cancelled
Test / ${{ matrix.platform }} | 1.${{ matrix.go }}.x (19, macOS) (push) Has been cancelled
Test / ${{ matrix.platform }} | 1.${{ matrix.go }}.x (19, ubuntu) (push) Has been cancelled
Test / ${{ matrix.platform }} | 1.${{ matrix.go }}.x (20, macOS) (push) Has been cancelled
Test / ${{ matrix.platform }} | 1.${{ matrix.go }}.x (20, ubuntu) (push) Has been cancelled
Test / ${{ matrix.platform }} | 1.${{ matrix.go }}.x (21, macOS) (push) Has been cancelled
Test / ${{ matrix.platform }} | 1.${{ matrix.go }}.x (21, ubuntu) (push) Has been cancelled
Test / ${{ matrix.platform }} | 1.${{ matrix.go }}.x (22, macOS) (push) Has been cancelled
Test / ${{ matrix.platform }} | 1.${{ matrix.go }}.x (22, ubuntu) (push) Has been cancelled
Test / ${{ matrix.platform }} | 1.${{ matrix.go }}.x (23, macOS) (push) Has been cancelled
Test / ${{ matrix.platform }} | 1.${{ matrix.go }}.x (23, ubuntu) (push) Has been cancelled
Test / MINGW64 (push) Has been cancelled
This commit is contained in:
parent
78bfc837fe
commit
6d888d3313
@ -27,6 +27,7 @@ import (
|
|||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"git.vinchent.xyz/vinchent/go-web/framework"
|
||||||
flag "github.com/spf13/pflag"
|
flag "github.com/spf13/pflag"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -254,6 +255,9 @@ type Command struct {
|
|||||||
// SuggestionsMinimumDistance defines minimum levenshtein distance to display suggestions.
|
// SuggestionsMinimumDistance defines minimum levenshtein distance to display suggestions.
|
||||||
// Must be > 0.
|
// Must be > 0.
|
||||||
SuggestionsMinimumDistance int
|
SuggestionsMinimumDistance int
|
||||||
|
|
||||||
|
// GoWeb service container
|
||||||
|
container framework.Container
|
||||||
}
|
}
|
||||||
|
|
||||||
// Context returns underlying command context. If command was executed
|
// Context returns underlying command context. If command was executed
|
||||||
|
11
go.mod
11
go.mod
@ -1,10 +1,19 @@
|
|||||||
module github.com/spf13/cobra
|
module github.com/spf13/cobra
|
||||||
|
|
||||||
go 1.15
|
go 1.22.5
|
||||||
|
|
||||||
|
toolchain go1.23.1
|
||||||
|
|
||||||
require (
|
require (
|
||||||
|
git.vinchent.xyz/vinchent/go-web v0.0.0-20240929215000-f0fc7ee2cb65
|
||||||
github.com/cpuguy83/go-md2man/v2 v2.0.4
|
github.com/cpuguy83/go-md2man/v2 v2.0.4
|
||||||
github.com/inconshreveable/mousetrap v1.1.0
|
github.com/inconshreveable/mousetrap v1.1.0
|
||||||
github.com/spf13/pflag v1.0.5
|
github.com/spf13/pflag v1.0.5
|
||||||
gopkg.in/yaml.v3 v3.0.1
|
gopkg.in/yaml.v3 v3.0.1
|
||||||
)
|
)
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/kr/text v0.2.0 // indirect
|
||||||
|
github.com/rogpeppe/go-internal v1.9.0 // indirect
|
||||||
|
github.com/russross/blackfriday/v2 v2.1.0 // indirect
|
||||||
|
)
|
||||||
|
12
go.sum
12
go.sum
@ -1,12 +1,22 @@
|
|||||||
|
git.vinchent.xyz/vinchent/go-web v0.0.0-20240929215000-f0fc7ee2cb65 h1:7sHTzY0WpgX4UW2g+dp+icvRyfcreP1fknOJ7/EDvtY=
|
||||||
|
git.vinchent.xyz/vinchent/go-web v0.0.0-20240929215000-f0fc7ee2cb65/go.mod h1:0t1NertSVVZD1FU7F6RkLb1Y5lcLU96pWygIOIeYjTI=
|
||||||
github.com/cpuguy83/go-md2man/v2 v2.0.4 h1:wfIWP927BUkWJb2NmU/kNDYIBTh/ziUX91+lVfRxZq4=
|
github.com/cpuguy83/go-md2man/v2 v2.0.4 h1:wfIWP927BUkWJb2NmU/kNDYIBTh/ziUX91+lVfRxZq4=
|
||||||
github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
||||||
|
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||||
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
|
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
|
||||||
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
|
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
|
||||||
|
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
||||||
|
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
||||||
|
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||||
|
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||||
|
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
|
||||||
|
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
|
||||||
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
|
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
|
||||||
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||||
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||||
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
|
||||||
|
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
|
11
goweb_command.go
Normal file
11
goweb_command.go
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
package cobra
|
||||||
|
|
||||||
|
import "git.vinchent.xyz/vinchent/go-web/framework"
|
||||||
|
|
||||||
|
func (c *Command) SetContainer(container framework.Container) {
|
||||||
|
c.container = container
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Command) GetContainer() framework.Container {
|
||||||
|
return c.Root().container
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user