maaslalani / confetty

Confetti in your TTY
MIT License
398 stars 18 forks source link

[Idea] Add an easy way use this in other cli apps. #5

Closed btvoidx closed 2 years ago

btvoidx commented 2 years ago

For example, a cli app that creates/set-ups something could add confetti/fireworks to it's "done, go have fun" message.

CamiloGarciaLaRotta commented 2 years ago

Given that we have access to the binary, a workaround for now is to directly call it.

#!/bin/bash

# some code, and then
confetty

But +1 to the request, it would be nice not to have to exec.Command("confetty") in Go, but rather import the package directly.


edit: actually, we could just import the confetti and firework packages into another Go project directly

package main

import (
    "fmt"
    "os"

    tea "github.com/charmbracelet/bubbletea"
    "github.com/maaslalani/confetty/confetti"
)

func main() {
    model := confetti.InitialModel()
    p := tea.NewProgram(model, tea.WithAltScreen())
    if err := p.Start(); err != nil {
        fmt.Fprintln(os.Stderr, err)
        os.Exit(1)
    }
}
sheldonhull commented 2 years ago

I'd love to see this so I could do a timed call. This example is fantastics, but I want to put at the end of a CLI task and have it proceed after a couple seconds similar like:

confetti.Start(2,confetti.Confetti, "Winner Winner Chicken Dinner")
confetti.Start(2,Confetti.Fireworks, "Winner Winner Chicken Dinner")

Just a general idea, something to spice up the ending notes but make sure I don't have to ctrl+c exiting.

This is such a fun little app. My kids think I'm cool now when they come to use my terminal. :grin:

maaslalani commented 2 years ago

Closing since I believe https://github.com/maaslalani/confetty/issues/5#issuecomment-961509275 is the correct solution.