Skip to content
Myr

command.go

This file

Path

join/command.go

33 lines · 1.2 KiB · Go

Last changed by

chore: prepare v2 (#1116)Drew Smirnoffbefore adoption02d6f06

History of this file

Take it

1// Package join provides a shell script interface for the lipgloss2// JoinHorizontal and JoinVertical commands. It allows you to join multi-line3// text to build different layouts.4//5// For example, you can place two bordered boxes next to each other: Note: We6// wrap the variable in quotes to ensure the new lines are part of a single7// argument. Otherwise, the command won't work as expected.8//9// $ gum join --horizontal "$BUBBLE_BOX" "$GUM_BOX"10//11// ╔══════════════════════╗╔═════════════╗12// ║                      ║║             ║13// ║        Bubble        ║║     Gum     ║14// ║                      ║║             ║15// ╚══════════════════════╝╚═════════════╝16package join1718import (19	"charm.land/lipgloss/v2"2021	"charm.land/gum/v2/internal/decode"22	"charm.land/gum/v2/internal/tty"23)2425// Run is the command-line interface for the joining strings through lipgloss.26func (o Options) Run() error {27	join := lipgloss.JoinHorizontal28	if o.Vertical {29		join = lipgloss.JoinVertical30	}31	tty.Println(join(decode.Align[o.Align], o.Text...))32	return nil33}