Skip to content

Commit

Permalink
interactive.go
Browse files Browse the repository at this point in the history
  • Loading branch information
maaslalani committed Jan 26, 2024
1 parent 1baa102 commit 989b784
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/alecthomas/chroma v0.10.1-0.20220126230913-d491f1b5c1d2
github.com/alecthomas/kong v0.8.1
github.com/beevik/etree v1.3.0
github.com/charmbracelet/huh v0.2.4-0.20240119002230-42853f5e6a3e
github.com/charmbracelet/huh v0.3.1-0.20240125205708-bb9c8f48a9f4
github.com/charmbracelet/lipgloss v0.9.1
github.com/charmbracelet/log v0.3.1
github.com/mattn/go-isatty v0.0.20
Expand All @@ -16,7 +16,7 @@ require (
github.com/atotto/clipboard v0.1.4 // indirect
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
github.com/catppuccin/go v0.2.0 // indirect
github.com/charmbracelet/bubbles v0.17.2-0.20240108170749-ec883029c8e6 // indirect
github.com/charmbracelet/bubbles v0.17.2-0.20240125161725-fc18779a6ae9 // indirect
github.com/charmbracelet/bubbletea v0.25.0 // indirect
github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81 // indirect
github.com/dlclark/regexp2 v1.10.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ github.com/beevik/etree v1.3.0 h1:hQTc+pylzIKDb23yYprodCWWTt+ojFfUZyzU09a/hmU=
github.com/beevik/etree v1.3.0/go.mod h1:aiPf89g/1k3AShMVAzriilpcE4R/Vuor90y83zVZWFc=
github.com/catppuccin/go v0.2.0 h1:ktBeIrIP42b/8FGiScP9sgrWOss3lw0Z5SktRoithGA=
github.com/catppuccin/go v0.2.0/go.mod h1:8IHJuMGaUUjQM82qBrGNBv7LFq6JI3NnQCF6MOlZjpc=
github.com/charmbracelet/bubbles v0.17.2-0.20240108170749-ec883029c8e6 h1:6nVCV8pqGaeyxetur3gpX3AAaiyKgzjIoCPV3NXKZBE=
github.com/charmbracelet/bubbles v0.17.2-0.20240108170749-ec883029c8e6/go.mod h1:9HxZWlkCqz2PRwsCbYl7a3KXvGzFaDHpYbSYMJ+nE3o=
github.com/charmbracelet/bubbles v0.17.2-0.20240125161725-fc18779a6ae9 h1:DgM7KYTYQqfv7FmUFsSMgjpzsQgZPToBKANhrbgEGmg=
github.com/charmbracelet/bubbles v0.17.2-0.20240125161725-fc18779a6ae9/go.mod h1:bFPs/pcBrPDNRHK9DOOctOwvdSjRtdA5iFmhdQ/QT7w=
github.com/charmbracelet/bubbletea v0.25.0 h1:bAfwk7jRz7FKFl9RzlIULPkStffg5k6pNt5dywy4TcM=
github.com/charmbracelet/bubbletea v0.25.0/go.mod h1:EN3QDR1T5ZdWmdfDzYcqOCAps45+QIJbLOBxmVNWNNg=
github.com/charmbracelet/lipgloss v0.9.1 h1:PNyd3jvaJbg4jRHKWXnCj1akQm4rh8dbEzN1p/u1KWg=
Expand Down
10 changes: 10 additions & 0 deletions form.go → interactive.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,12 @@ func runForm(config *Config) (*Config, error) {
Validate(validateInteger),
),
).WithTheme(theme).WithHeight(10)

// Let's first select a input file if not specified
if config.Input == "" {
config.Input = pickFile()
}

err := f.Run()

config.Padding = parsePadding(padding)
Expand Down Expand Up @@ -260,3 +266,7 @@ func parsePadding(v string) []int {
}

var parseMargin = parsePadding

func pickFile() string {
return "main.go"
}

0 comments on commit 989b784

Please sign in to comment.