mirror of
https://github.com/charmbracelet/gum
synced 2024-06-08 00:32:17 +02:00
7190822247
Instead of needing to run the commands manually in main.go, we can implement the `Run(...) error` method to satisfy the command interface so that `kong` can Run our commands for us.
19 lines
380 B
Go
19 lines
380 B
Go
package join
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/charmbracelet/gum/internal/decode"
|
|
"github.com/charmbracelet/lipgloss"
|
|
)
|
|
|
|
// Run is the command-line interface for the joining strings through lipgloss.
|
|
func (o Options) Run() error {
|
|
join := lipgloss.JoinHorizontal
|
|
if o.Vertical {
|
|
join = lipgloss.JoinVertical
|
|
}
|
|
fmt.Println(join(decode.Align[o.Align], o.Text...))
|
|
return nil
|
|
}
|