Skip to content

Commit

Permalink
feat(nav): add skim/depth flags (#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
plastikfan committed Dec 28, 2023
1 parent d144d88 commit 6f67c65
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 14 deletions.
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ require (
github.com/onsi/gomega v1.30.0
github.com/pkg/errors v0.9.1
github.com/samber/lo v1.39.0
github.com/snivilised/extendio v0.5.1
github.com/snivilised/extendio v0.5.2
github.com/snivilised/lorax v0.4.2
github.com/spf13/cobra v1.8.0
github.com/spf13/viper v1.18.1
github.com/spf13/viper v1.18.2
go.uber.org/zap v1.26.0
)

Expand All @@ -20,7 +20,7 @@ require (
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/pprof v0.0.0-20231212022811-ec68065c825e // indirect
github.com/google/uuid v1.4.0 // indirect
github.com/google/uuid v1.5.0 // indirect
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
github.com/onsi/ginkgo v1.16.5 // indirect
github.com/sagikazarmark/locafero v0.4.0 // indirect
Expand All @@ -41,7 +41,7 @@ require (
github.com/natefinch/lumberjack v2.0.0+incompatible
github.com/nicksnyder/go-i18n/v2 v2.3.0 // indirect
github.com/pelletier/go-toml/v2 v2.1.1 // indirect
github.com/snivilised/cobrass v0.4.1
github.com/snivilised/cobrass v0.4.2
github.com/spf13/afero v1.11.0 // indirect
github.com/spf13/cast v1.6.0 // indirect
github.com/spf13/pflag v1.0.5
Expand Down
18 changes: 8 additions & 10 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/pprof v0.0.0-20231212022811-ec68065c825e h1:bwOy7hAFd0C91URzMIEBfr6BAz29yk7Qj0cy6S7DJlU=
github.com/google/pprof v0.0.0-20231212022811-ec68065c825e/go.mod h1:czg5+yv1E0ZGTi6S6vVK1mke0fV+FaUhNGcd6VRS9Ik=
github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4=
github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.5.0 h1:1p67kYwdtXjb0gL0BPiP1Av9wiZPo5A8z2cWkTZ+eyU=
github.com/google/uuid v1.5.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
Expand Down Expand Up @@ -88,12 +88,10 @@ github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6g
github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ=
github.com/samber/lo v1.39.0 h1:4gTz1wUhNYLhFSKl6O+8peW0v2F4BCY034GRpU9WnuA=
github.com/samber/lo v1.39.0/go.mod h1:+m/ZKRl6ClXCE2Lgf3MsQlWfh4bn1bz6CXEOxnEXnEA=
github.com/snivilised/cobrass v0.4.1 h1:0CpC6eIIxj/x7UW3Ba3BCP35LyEamslOaimGxlTwGSk=
github.com/snivilised/cobrass v0.4.1/go.mod h1:WFbmSiPNREW3cP3cuZ3EJrDgMUKgHQw13RNv6rCgyoo=
github.com/snivilised/extendio v0.5.0 h1:XxUW125nGxkluVOekzWWpoE80r5KL0e+MFP2gjiXOhc=
github.com/snivilised/extendio v0.5.0/go.mod h1:jBaeTO9432bNbBKR4mbt2d7OGyrDPY/U45siM3VhTks=
github.com/snivilised/extendio v0.5.1 h1:CHvhyTboVOHLj8rm0ZF5dm3jPViHKPAKQxvnI8WzqAo=
github.com/snivilised/extendio v0.5.1/go.mod h1:jBaeTO9432bNbBKR4mbt2d7OGyrDPY/U45siM3VhTks=
github.com/snivilised/cobrass v0.4.2 h1:V2LqFKZWYqdewSRPeLFqyKPfOr96ihs4+ixSnP/528U=
github.com/snivilised/cobrass v0.4.2/go.mod h1:bweMGepAjflKLqlCLkGi+Jvdru6ttdOr3L75rKq2yA8=
github.com/snivilised/extendio v0.5.2 h1:gpaA5hGM0DCyY1PHy51fnmAI76tzCOOo4rteyuWSTDI=
github.com/snivilised/extendio v0.5.2/go.mod h1:Ctp0GkEwMJ51FmgJE9nLLv86VTWILzgILdTgAeQ+BME=
github.com/snivilised/lorax v0.4.2 h1:jPo+o4cP/BUYBkR6sg3oLybHx0j2R+0wMLnvOf/gh0g=
github.com/snivilised/lorax v0.4.2/go.mod h1:vyhM905Fc4fzShAXPvykS8ZRnO6B85hd0emJgZE4iNY=
github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo=
Expand All @@ -106,8 +104,8 @@ github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0=
github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho=
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/viper v1.18.1 h1:rmuU42rScKWlhhJDyXZRKJQHXFX02chSVW1IvkPGiVM=
github.com/spf13/viper v1.18.1/go.mod h1:EKmWIqdnk5lOcmR72yw6hS+8OPYcwD0jteitLMVB+yk=
github.com/spf13/viper v1.18.2 h1:LUXCnvUvSM6FXAsj6nnfc8Q2tp1dIgUfY9Kc8GsSOiQ=
github.com/spf13/viper v1.18.2/go.mod h1:EKmWIqdnk5lOcmR72yw6hS+8OPYcwD0jteitLMVB+yk=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
Expand Down
10 changes: 10 additions & 0 deletions src/app/command/root-cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const (
WorkerPoolFamName = "worker-pool-family"
FoldersFamName = "folders-family"
ProfileFamName = "profile-family"
CascadeFamName = "cascade-family"
)

func Execute() error {
Expand Down Expand Up @@ -124,13 +125,19 @@ func (b *Bootstrap) buildRootCommand(container *assistant.CobraContainer) {
profileFam := assistant.NewParamSet[store.ProfileParameterSet](rootCommand)
profileFam.Native.BindAll(profileFam, rootCommand.PersistentFlags())

// family: cascade [--depth, --skim(K)]
//
cascadeFam := assistant.NewParamSet[store.CascadeParameterSet](rootCommand)
cascadeFam.Native.BindAll(cascadeFam, rootCommand.PersistentFlags())

// ??? rootCommand.Args = validatePositionalArgs

container.MustRegisterParamSet(RootPsName, paramSet)
container.MustRegisterParamSet(PreviewFamName, previewFam)
container.MustRegisterParamSet(WorkerPoolFamName, workerPoolFam)
container.MustRegisterParamSet(FoldersFamName, foldersFam)
container.MustRegisterParamSet(ProfileFamName, profileFam)
container.MustRegisterParamSet(CascadeFamName, cascadeFam)
}

func (b *Bootstrap) getRootInputs() *proxy.RootCommandInputs {
Expand All @@ -150,5 +157,8 @@ func (b *Bootstrap) getRootInputs() *proxy.RootCommandInputs {
ProfileFam: b.Container.MustGetParamSet(
ProfileFamName,
).(*assistant.ParamSet[store.ProfileParameterSet]),
CascadeFam: b.Container.MustGetParamSet(
CascadeFamName,
).(*assistant.ParamSet[store.CascadeParameterSet]),
}
}
36 changes: 36 additions & 0 deletions src/app/command/shrink-cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,42 @@ var _ = Describe("ShrinkCmd", Ordered, func() {
},
},
}),

Entry(nil, &shrinkTE{
commandTE: commandTE{
message: "vanilla with long form skim",
args: []string{
"--strip",
"--interlace", "plane",
"--quality", "85",
"--skim",
},
},
}),

Entry(nil, &shrinkTE{
commandTE: commandTE{
message: "vanilla with short form skim",
args: []string{
"--strip",
"--interlace", "plane",
"--quality", "85",
"-K",
},
},
}),

Entry(nil, &shrinkTE{
commandTE: commandTE{
message: "vanilla with depth",
args: []string{
"--strip",
"--interlace", "plane",
"--quality", "85",
"--depth", "1",
},
},
}),
)

// NB: these tests are required because state does not work with
Expand Down
1 change: 1 addition & 0 deletions src/app/proxy/image-defs.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ type RootCommandInputs struct {
WorkerPoolFam *assistant.ParamSet[store.WorkerPoolParameterSet]
FoldersFam *assistant.ParamSet[store.FoldersFilterParameterSet]
ProfileFam *assistant.ParamSet[store.ProfileParameterSet]
CascadeFam *assistant.ParamSet[store.CascadeParameterSet]
}

type ShrinkCommandInputs struct {
Expand Down

0 comments on commit 6f67c65

Please sign in to comment.