Skip to content
Myr

command.go

This file

Path

format/command.go

49 lines · 973 bytes · Go

Last changed by

chore: prepare v2 (#1116)Drew Smirnoffbefore adoption02d6f06

History of this file

Take it

The walk stopped after 200 commits: lines older than 6837ed2 point at it.

feat(deps): bump github.com/charmbracelet/bubbletea from 0.27.0 to 1.0.0 (#661)dependabot[bot]before adoption6837ed2

lines 1–16why, one step back
1// Package format allows you to render formatted text from the command line.
2//3// It supports the following types:4//5// 1. Markdown6// 2. Code7// 3. Emoji8// 4. Template9//10// For more information, see the format/README.md file.11package format1213import (14 "fmt"15 "strings"16

chore: prepare v2 (#1116)Drew Smirnoffbefore adoption02d6f06

lines 17–18why, one step back
17 "charm.land/gum/v2/internal/stdin"
18 "charm.land/gum/v2/internal/tty"

feat(deps): bump github.com/charmbracelet/bubbletea from 0.27.0 to 1.0.0 (#661)dependabot[bot]before adoption6837ed2

lines 19–27why, one step back
19)
2021// Run runs the format command.22func (o Options) Run() error {23 var input, output string24 var err error25 if len(o.Template) > 0 {26 input = strings.Join(o.Template, "\n")27 } else {

feat: --no-strip-ansi (#784)Carlos Alexandro Beckerbefore adoption4cedf9f

line 28why, one step back
28 input, _ = stdin.Read(stdin.StripANSI(o.StripANSI))

feat(deps): bump github.com/charmbracelet/bubbletea from 0.27.0 to 1.0.0 (#661)dependabot[bot]before adoption6837ed2

lines 29–44why, one step back
29 }
3031 switch o.Type {32 case "code":33 output, err = code(input, o.Language)34 case "emoji":35 output, err = emoji(input)36 case "template":37 output, err = template(input)38 default:39 output, err = markdown(input, o.Theme)40 }41 if err != nil {42 return err43 }44

chore: update to bubbletea v2 (#1112)Drew Smirnoffbefore adoptionf6dd28e

lines 45–47why, one step back
45 if _, err := fmt.Fprint(tty.Writer(), output); err != nil {
46 return fmt.Errorf("unable to write output: %w", err)47 }

feat(deps): bump github.com/charmbracelet/bubbletea from 0.27.0 to 1.0.0 (#661)dependabot[bot]before adoption6837ed2

lines 48–49why, one step back
48 return nil
49}