Skip to content

Commit

Permalink
Improve install output
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianfeldmann committed Dec 19, 2023
1 parent bdf9c38 commit 5ff7b9e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions exec/installer.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/captainhook-go/captainhook/io"
"os"
"sort"
"strings"
"text/template"
)

Expand Down Expand Up @@ -59,12 +60,13 @@ func (i *Installer) Run() error {
return err
}
}
i.appIO.Write("<ok>hooks installed successfully</ok>", true, io.NORMAL)
return nil
}

func (i *Installer) installHook(hook string, ask bool) error {
if i.shouldHookBeSkipped(hook) {
hint := " <info>" + hook + "</info> is already installed"
hint := " <info>" + hook + "</info>" + strings.Repeat(" ", 30-len(hook)) + "skipped"
if i.appIO.IsDebug() {
hint = ", remove the --skip-existing option to overwrite."
}
Expand Down Expand Up @@ -109,7 +111,7 @@ func (i *Installer) writeHookFile(hook string) error {
file, _ := os.Create(i.repo.HooksDir() + "/" + hook)
defer file.Close()

i.appIO.Write(" installing <info>"+hook+"</info> to "+i.repo.HooksDir()+"/"+hook, true, io.VERBOSE)
i.appIO.Write(" <info>"+hook+"</info>"+strings.Repeat(" ", 30-len(hook))+"<ok>installed</ok>", true, io.VERBOSE)
tplErr := tpl.Execute(file, vars)
if tplErr != nil {
return tplErr
Expand Down

0 comments on commit 5ff7b9e

Please sign in to comment.