Skip to content

Commit

Permalink
chore: add yeet the child meme ascii text in case of yeet cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
AzraelSec committed Dec 18, 2023
1 parent ac3e940 commit 50fab8c
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 9 deletions.
8 changes: 6 additions & 2 deletions cmd/cli/commands/tag/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,19 @@ type cli struct {
repos []config.LiveRepo
tagFn tagRunnerFunc
tagArgs []tagInputPayload
isYeet bool
}

func newCli(g git.Git, repos []config.LiveRepo, tagPattern string, useCurrent, skipPush, pullBefore bool) *cli {
func newCli(g git.Git, repos []config.LiveRepo, tagPattern string, useCurrent, skipPush, pullBefore, isYeet bool) *cli {
tagFn, tagArgs := runnerArgs(g, repos, tagPattern, useCurrent, skipPush, pullBefore)
return &cli{repos, tagFn, tagArgs}
return &cli{repos, tagFn, tagArgs, isYeet}
}

func (c *cli) run() {
var out bytes.Buffer
if c.isYeet {
out.WriteString(YEET_ASCII_IMAGE)
}
res := runner.Run(c.tagFn, c.tagArgs)

for idx, r := range res {
Expand Down
9 changes: 4 additions & 5 deletions cmd/cli/commands/tag/tag.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,11 @@ func (t *tagCmd) Command() *cobra.Command {
return nil
}

if *disableTui {
newCli(t.g, repos, t.cm.TagPattern, *useCurrent, *skipPush, *pullBefore).run()
} else {
return newTui(t.g, repos, t.cm.TagPattern, *useCurrent, *skipPush, *pullBefore).run()
isYeet := cmd.CalledAs() == "yeet"
if !*disableTui {
return newTui(t.g, repos, t.cm.TagPattern, *useCurrent, *skipPush, *pullBefore, isYeet).run()
}

newCli(t.g, repos, t.cm.TagPattern, *useCurrent, *skipPush, *pullBefore, isYeet).run()
return nil
},
}
Expand Down
11 changes: 9 additions & 2 deletions cmd/cli/commands/tag/tui.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ type tui struct {
repos []config.LiveRepo
tagFn tagRunnerFunc
tagArgs []tagInputPayload
isYeet bool
}

func newTui(g git.Git, repos []config.LiveRepo, tagPattern string, useCurrent, skipPush, pullBefore bool) *tui {
func newTui(g git.Git, repos []config.LiveRepo, tagPattern string, useCurrent, skipPush, pullBefore, isYeet bool) *tui {
tagFn, tagArgs := runnerArgs(g, repos, tagPattern, useCurrent, skipPush, pullBefore)
return &tui{repos, tagFn, tagArgs}
return &tui{repos, tagFn, tagArgs, isYeet}
}

func (t *tui) initModel() *model {
Expand All @@ -39,6 +40,7 @@ func (t *tui) initModel() *model {
tasks: tasks,
completed: make([]int, 0, len(tasks)),
spinner: ui.NewSpinner(),
isYeet: t.isYeet,
}
}

Expand Down Expand Up @@ -70,6 +72,7 @@ type model struct {
completed []int

spinner spinner.Model
isYeet bool
}

type tagStartMsg struct{ idx int }
Expand Down Expand Up @@ -145,6 +148,10 @@ func (m *model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {

func (m *model) View() string {
var buff bytes.Buffer
if m.isYeet {
buff.WriteString(YEET_ASCII_IMAGE)
}

for _, task := range m.tasks {
buff.WriteString(m.renderTaskRow(task))
buff.WriteString("\n")
Expand Down
31 changes: 31 additions & 0 deletions cmd/cli/commands/tag/yeet.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package tag

const YEET_ASCII_IMAGE = `
**=
.*=+= .=++===++=.
+=-=- :*+. :=+-.
-*-.+- -* .+-:: -=-
.*= .=- @..::-:-+-:. :+:
-+ .=- %. :::..=+=:. #:
.+- .=+#: .:::.:-. -++...
:+: .+#*=. . :-+#===+*=.
-=: -*=#*+=-:..:-=*#*+-------=+:
+: .:----=++++#*+==---==++-. -+=.
-= :---==-:. -*-. -+.
:= .--*=. ++-. :@##*=.
.* :-=+ *#+==#***%%=
=-----. * .-+= -=---#%%%%##**#%%@:
:= :--: =: -+= .+. .###**#%++**=*
-- .-= :=+ *.: .-.%**##. *+ +
=: -+ +:-. .:=@##%: :#.=.
=: :+---=. .-- -===+*%%%##- --
+: .-*: :++-:. -=. .:*+*+
+: --# -++--:. -=. *-#:
+: --* .=+=--:..-=.
=: --* :=+=---:+=:
-- --+ :=++---++=.
-+ -++::::. :=++=--++===: ..:::---------:::.
.*#*=--=#=-----. :=++=---+*---------------------
...... :-=+=#:------------------:.
:-
`

0 comments on commit 50fab8c

Please sign in to comment.