Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ vars:
SNAPSHOT_BIN: "{{ .ROOT_DIR }}/{{ .SNAPSHOT_DIR }}/{{ OS }}-build_{{ OS }}_{{ ARCH }}/{{ .PROJECT }}"
CHANGELOG: CHANGELOG.md
NEXT_VERSION: VERSION
MAKEDIR_P: 'python -c "import sys; import os; os.makedirs(sys.argv[1], exist_ok=True)"'
MAKEDIR_P: 'python3 -c "import sys; import os; os.makedirs(sys.argv[1], exist_ok=True)"'

GORELEASER_CMD: "{{ .TOOL_DIR }}/goreleaser release --clean --skip=publish --skip=sign --snapshot --config {{ .TMP_DIR }}/goreleaser.yaml"
BUILD_CMD: "{{ .TOOL_DIR }}/goreleaser build --clean --single-target --snapshot --config {{ .TMP_DIR }}/goreleaser.yaml"
Expand Down Expand Up @@ -146,15 +146,15 @@ tasks:
desc: Run all unit tests
vars:
TEST_PKGS:
sh: "python ./scripts/list_units.py anchore binny"
sh: "python3 ./scripts/list_units.py anchore binny"

# unit test coverage threshold (in % coverage)
COVERAGE_THRESHOLD: 35
cmds:
- cmd: "{{ .MAKEDIR_P }} {{ .TMP_DIR }}"
silent: true
- "go test -coverprofile {{ .TMP_DIR }}/unit-coverage-details.txt {{ .TEST_PKGS }}"
- cmd: '{{if eq OS "windows"}}python {{end}}.github/scripts/coverage.py {{ .COVERAGE_THRESHOLD }} {{ .TMP_DIR }}/unit-coverage-details.txt'
- cmd: '{{if eq OS "windows"}}python3 {{end}}.github/scripts/coverage.py {{ .COVERAGE_THRESHOLD }} {{ .TMP_DIR }}/unit-coverage-details.txt'
silent: true

cli:
Expand Down
8 changes: 4 additions & 4 deletions cmd/binny/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,18 @@ func New(id clio.Identification) clio.Application {
WithConfigInRootHelp(). // --help on the root command renders the full application config in the help text
WithUIConstructor(
// select a UI based on the logging configuration and state of stdin (if stdin is a tty)
func(cfg clio.Config) ([]clio.UI, error) {
func(cfg clio.Config) (*clio.UICollection, error) {
noUI := ui.None(cfg.Log.Quiet)
if !cfg.Log.AllowUI(os.Stdin) || cfg.Log.Quiet {
return []clio.UI{noUI}, nil
return clio.NewUICollection(noUI), nil
}

return []clio.UI{
return clio.NewUICollection(
ui.New(cfg.Log.Quiet,
handler.New(handler.DefaultHandlerConfig()),
),
noUI,
}, nil
), nil
},
).
WithLoggingConfig(clio.LoggingConfig{
Expand Down
6 changes: 5 additions & 1 deletion cmd/binny/cli/internal/ui/ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,17 @@ func (m *UI) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
return m, nil
}

for _, newModel := range m.handler.Handle(msg) {
newModels, handlerCmd := m.handler.Handle(msg)
for _, newModel := range newModels {
if newModel == nil {
continue
}
cmds = append(cmds, newModel.Init())
m.frame.(*frame.Frame).AppendModel(newModel)
}
if handlerCmd != nil {
cmds = append(cmds, handlerCmd)
}
// intentionally fallthrough to update the frame model
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/binny/cli/ui/handle_install_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ func TestHandler_install(t *testing.T) {
}
}

models := handler.Handle(start)
models, _ := handler.Handle(start)

require.Len(t, models, 1)
model := models[0]
Expand Down
2 changes: 1 addition & 1 deletion cmd/binny/cli/ui/handle_task_started_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func TestHandler_taskStarted(t *testing.T) {
Height: 80,
}

models := handler.Handle(e)
models, _ := handler.Handle(e)
require.Len(t, models, 1)
model := models[0]

Expand Down
2 changes: 1 addition & 1 deletion cmd/binny/cli/ui/handle_update_lock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ func TestHandler_updateLock(t *testing.T) {
})
}

models := handler.Handle(events[0])
models, _ := handler.Handle(events[0])

require.Len(t, models, 1)
model := models[0]
Expand Down
12 changes: 9 additions & 3 deletions cmd/binny/cli/ui/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,20 @@ func New(cfg HandlerConfig) *Handler {

// register all supported event types with the respective handler functions
d.AddHandlers(map[partybus.EventType]bubbly.EventHandlerFn{
event.CLIInstallCmdStarted: h.handleCLIInstallCmdStarted,
event.CLIUpdateCmdStarted: h.handleCLIUpdateLockCmdStarted,
event.TaskStartedEvent: h.handleTaskStarted,
event.CLIInstallCmdStarted: simpleHandler(h.handleCLIInstallCmdStarted),
event.CLIUpdateCmdStarted: simpleHandler(h.handleCLIUpdateLockCmdStarted),
event.TaskStartedEvent: simpleHandler(h.handleTaskStarted),
})

return h
}

func simpleHandler(fn func(partybus.Event) []tea.Model) bubbly.EventHandlerFn {
return func(e partybus.Event) ([]tea.Model, tea.Cmd) {
return fn(e), nil
}
}

func (m *Handler) OnMessage(msg tea.Msg) {
if msg, ok := msg.(tea.WindowSizeMsg); ok {
m.WindowSize = msg
Expand Down
48 changes: 24 additions & 24 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
module github.com/anchore/binny

go 1.24.2
go 1.25.0

require (
github.com/Masterminds/semver/v3 v3.4.0
github.com/Masterminds/sprig/v3 v3.3.0
github.com/OneOfOne/xxhash v1.2.8
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d
github.com/anchore/bubbly v0.0.0-20230919123500-747f4abea05f
github.com/anchore/clio v0.0.0-20230823172630-c42d666061af
github.com/anchore/fangs v0.0.0-20230818131516-2186b10924fe
github.com/anchore/go-logger v0.0.0-20230725134548-c21dafa1ec5a
github.com/anchore/bubbly v0.2.1-0.20260421185418-fee7830c481c
github.com/anchore/clio v0.1.1-0.20260421190722-794b9b055b72
github.com/anchore/fangs v0.1.1-0.20260421185343-df607d667563
github.com/anchore/go-logger v0.1.1-0.20260421185257-01c4e7fbebe1
github.com/chainguard-dev/yam v0.2.53
github.com/charmbracelet/bubbles v1.0.0
github.com/charmbracelet/bubbletea v1.3.10
Expand Down Expand Up @@ -40,17 +40,18 @@ require (
golang.org/x/net v0.50.0
golang.org/x/oauth2 v0.35.0
golang.org/x/sync v0.19.0
golang.org/x/term v0.40.0
golang.org/x/term v0.42.0
gopkg.in/yaml.v3 v3.0.1
)

require (
dario.cat/mergo v1.0.1 // indirect
dario.cat/mergo v1.0.2 // indirect
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/ProtonMail/go-crypto v1.1.6 // indirect
github.com/STARRY-S/zip v0.2.3 // indirect
github.com/adrg/xdg v0.4.0 // indirect
github.com/adrg/xdg v0.5.3 // indirect
github.com/anchore/go-homedir v0.1.0 // indirect
github.com/andybalholm/brotli v1.2.0 // indirect
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
Expand All @@ -67,26 +68,26 @@ require (
github.com/clipperhouse/stringish v0.1.1 // indirect
github.com/clipperhouse/uax29/v2 v2.5.0 // indirect
github.com/cloudflare/circl v1.6.3 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/dsnet/compress v0.0.2-0.20230904184137-39efe44ab707 // indirect
github.com/emirpasic/gods v1.18.1 // indirect
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect
github.com/felixge/fgprof v0.9.3 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/fsnotify/fsnotify v1.9.0 // indirect
github.com/gkampitakis/ciinfo v0.3.2 // indirect
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
github.com/go-git/go-billy/v5 v5.8.0 // indirect
github.com/go-openapi/errors v0.20.3 // indirect
github.com/go-openapi/strfmt v0.21.7 // indirect
github.com/go-viper/mapstructure/v2 v2.5.0 // indirect
github.com/goccy/go-yaml v1.18.0 // indirect
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect
github.com/google/pprof v0.0.0-20221118152302-e6195bd50e26 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/gookit/color v1.5.4 // indirect
github.com/gookit/color v1.6.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/huandu/xstrings v1.5.0 // indirect
github.com/iancoleman/strcase v0.3.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
Expand All @@ -98,7 +99,6 @@ require (
github.com/kr/pretty v0.3.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/lucasb-eyer/go-colorful v1.3.0 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/maruel/natural v1.1.1 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
Expand All @@ -108,34 +108,34 @@ require (
github.com/mikelolasagasti/xz v1.0.1 // indirect
github.com/minio/minlz v1.0.1 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect
github.com/muesli/cancelreader v0.2.2 // indirect
github.com/muesli/termenv v0.16.0 // indirect
github.com/nwaples/rardecode/v2 v2.2.0 // indirect
github.com/oklog/ulid v1.3.1 // indirect
github.com/pborman/indent v1.2.1 // indirect
github.com/pelletier/go-toml/v2 v2.0.8 // indirect
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
github.com/pierrec/lz4/v4 v4.1.22 // indirect
github.com/pjbgf/sha1cd v0.3.2 // indirect
github.com/pkg/profile v1.7.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/rogpeppe/go-internal v1.14.1 // indirect
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 // indirect
github.com/sagikazarmark/locafero v0.11.0 // indirect
github.com/sergi/go-diff v1.4.0 // indirect
github.com/shopspring/decimal v1.4.0 // indirect
github.com/shurcooL/graphql v0.0.0-20230722043721-ed46e5a46466 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/sirupsen/logrus v1.9.4 // indirect
github.com/skeema/knownhosts v1.3.1 // indirect
github.com/sorairolake/lzip-go v0.3.8 // indirect
github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 // indirect
github.com/spf13/afero v1.15.0 // indirect
github.com/spf13/cast v1.7.0 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.9 // indirect
github.com/spf13/viper v1.16.0 // indirect
github.com/subosito/gotenv v1.4.2 // indirect
github.com/spf13/cast v1.10.0 // indirect
github.com/spf13/pflag v1.0.10 // indirect
github.com/spf13/viper v1.21.0 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/tidwall/gjson v1.18.0 // indirect
github.com/tidwall/match v1.1.1 // indirect
github.com/tidwall/pretty v1.2.1 // indirect
Expand All @@ -144,10 +144,10 @@ require (
github.com/xanzy/ssh-agent v0.3.3 // indirect
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
go.mongodb.org/mongo-driver v1.11.3 // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect
go4.org v0.0.0-20230225012048-214862532bf5 // indirect
golang.org/x/crypto v0.48.0 // indirect
golang.org/x/sys v0.41.0 // indirect
golang.org/x/sys v0.43.0 // indirect
golang.org/x/text v0.34.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
)
Loading
Loading