update example
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
"gitoa.ru/go-4devs/config/provider/env"
|
||||
"gitoa.ru/go-4devs/config/provider/memory"
|
||||
"gitoa.ru/go-4devs/console"
|
||||
"gitoa.ru/go-4devs/console/command/dump"
|
||||
"gitoa.ru/go-4devs/console/example/pkg/command"
|
||||
)
|
||||
|
||||
@@ -23,12 +24,13 @@ func main() {
|
||||
console.
|
||||
New(console.WithInput(
|
||||
chain.New(
|
||||
arg.New(arg.WithArgs(os.Args)),
|
||||
arg.New(arg.WithArgs(os.Args[console.ResolveSkip(0):])),
|
||||
env.New(Namespace, AppName),
|
||||
&memory.Default{},
|
||||
),
|
||||
)).
|
||||
Add(
|
||||
dump.Command(),
|
||||
command.Long(),
|
||||
command.Args(),
|
||||
).
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
|
||||
"gitoa.ru/go-4devs/console"
|
||||
"gitoa.ru/go-4devs/console/command/dump"
|
||||
"gitoa.ru/go-4devs/console/example/pkg/command"
|
||||
)
|
||||
|
||||
@@ -11,6 +12,7 @@ func main() {
|
||||
console.
|
||||
New().
|
||||
Add(
|
||||
dump.Command(),
|
||||
command.Hello(),
|
||||
command.Args(),
|
||||
command.Hidden(),
|
||||
|
||||
@@ -5,6 +5,6 @@ go 1.24.0
|
||||
toolchain go1.24.1
|
||||
|
||||
require (
|
||||
gitoa.ru/go-4devs/config v0.0.8
|
||||
gitoa.ru/go-4devs/console v0.2.1-0.20260105202444-e2c6fc0a35a4
|
||||
gitoa.ru/go-4devs/config v0.0.10
|
||||
gitoa.ru/go-4devs/console v0.4.0
|
||||
)
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
gitoa.ru/go-4devs/config v0.0.8 h1:o4p8I9jWJMfiFVVKr50IqCGj1fF+8kmSPDkH0deRvn4=
|
||||
gitoa.ru/go-4devs/config v0.0.8/go.mod h1:jHKqVafFVW400LC0M4i1ifPapiI9sqpX/QTh+VMadKw=
|
||||
gitoa.ru/go-4devs/console v0.2.0 h1:6lsbArs99GA8vGdnwNDThZNKjFNctNtTlSCUjhgwIpU=
|
||||
gitoa.ru/go-4devs/console v0.2.0/go.mod h1:xi4Svw7T+lylckAQiJQS/2qwDwF4YbIanlhcbQrBAiI=
|
||||
gitoa.ru/go-4devs/console v0.2.1-0.20260105202444-e2c6fc0a35a4 h1:zOk/59IvgUfCDL6ub6WX4hsqDK79FsZR0gf7s7t3fXM=
|
||||
gitoa.ru/go-4devs/console v0.2.1-0.20260105202444-e2c6fc0a35a4/go.mod h1:PG/Zyj1dLh7eFlj9bgnV58+Ys6I/MTrS0q9W7oD7z4U=
|
||||
gitoa.ru/go-4devs/config v0.0.10 h1:NSagD0voj77/IGqRGsbR0DZmDvFcxbx+oRoWQnLnSy4=
|
||||
gitoa.ru/go-4devs/config v0.0.10/go.mod h1:cLW1+4E4uM4Pw+z4RuKEKbO1Lz6UTs2b2fTPyeEgTx8=
|
||||
gitoa.ru/go-4devs/console v0.4.0 h1:3N4VMWsHsaP32nWHxALxjPhp/MhYx1hXZdDl3xGJQ3k=
|
||||
gitoa.ru/go-4devs/console v0.4.0/go.mod h1:+J69iA4KQfC2H1FxItwL4pLkb3oW8g466qUSo0jWYjo=
|
||||
|
||||
@@ -5,12 +5,12 @@ import (
|
||||
|
||||
"gitoa.ru/go-4devs/config"
|
||||
"gitoa.ru/go-4devs/config/definition/option"
|
||||
cparam "gitoa.ru/go-4devs/config/param"
|
||||
"gitoa.ru/go-4devs/config/param"
|
||||
argument "gitoa.ru/go-4devs/config/provider/arg"
|
||||
"gitoa.ru/go-4devs/console"
|
||||
"gitoa.ru/go-4devs/console/command"
|
||||
"gitoa.ru/go-4devs/console/output"
|
||||
"gitoa.ru/go-4devs/console/param"
|
||||
"gitoa.ru/go-4devs/console/setting"
|
||||
)
|
||||
|
||||
func CreateUser(required bool) command.Command {
|
||||
@@ -19,7 +19,7 @@ func CreateUser(required bool) command.Command {
|
||||
"Creates a new user.",
|
||||
UserExecute,
|
||||
command.Configure(UserConfigure(required)),
|
||||
command.Help(func(param.HData) (string, error) {
|
||||
command.Help(func(setting.HData) (string, error) {
|
||||
return "This command allows you to create a user...", nil
|
||||
}),
|
||||
)
|
||||
@@ -27,7 +27,7 @@ func CreateUser(required bool) command.Command {
|
||||
|
||||
func UserConfigure(required bool) func(_ context.Context, cfg config.Definition) error {
|
||||
return func(_ context.Context, cfg config.Definition) error {
|
||||
var opts []cparam.Option
|
||||
var opts []param.Option
|
||||
if required {
|
||||
opts = append(opts, option.Required)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user