mirror of
https://github.com/lukaszraczylo/harness-sync.git
synced 2026-10-18 01:17:50 +00:00
feat: add internal/ui prompts + init subcommand
- internal/ui/prompts.go: MultiSelect with huh TUI + WithNonInteractive for tests - internal/cli/init.go: NewInit cobra command with --from/--no-prompt flags - internal/cli/init_test.go: TestInitImportWritesCanonical - internal/cli/root.go: add resolveRoot helper (shared by profile/rollback/show/init) - go.mod: add github.com/charmbracelet/huh v1.0.0 as direct dep
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
package ui
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestMultiSelectNonInteractive(t *testing.T) {
|
||||
sel, err := MultiSelect("pick", []string{"a", "b", "c"}, WithNonInteractive([]string{"a", "c"}))
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, []string{"a", "c"}, sel)
|
||||
}
|
||||
|
||||
func TestMultiSelectNonInteractiveInvalidChoice(t *testing.T) {
|
||||
_, err := MultiSelect("pick", []string{"a", "b"}, WithNonInteractive([]string{"z"}))
|
||||
assert.Error(t, err)
|
||||
}
|
||||
Reference in New Issue
Block a user