Skip to content

Commit

Permalink
style: ✨ Changed default select cmd, added high contrast colors
Browse files Browse the repository at this point in the history
Closes #265
  • Loading branch information
RamiAwar committed Feb 10, 2024
1 parent a6efb9a commit 6d0fa33
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions cmd/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,32 +41,32 @@ func list(cmd *cobra.Command, args []string) error {
// make sure multiline command printed as oneline
command = strings.Replace(command, "\n", "\\n", -1)
fmt.Fprintf(color.Output, "%s : %s\n",
color.GreenString(description), color.YellowString(command))
color.HiGreenString(description), color.HiYellowString(command))
} else {
fmt.Fprintf(color.Output, "%12s %s\n",
color.GreenString("Description:"), snippet.Description)
color.HiGreenString("Description:"), snippet.Description)
if strings.Contains(snippet.Command, "\n") {
lines := strings.Split(snippet.Command, "\n")
firstLine, restLines := lines[0], lines[1:]
fmt.Fprintf(color.Output, "%12s %s\n",
color.YellowString(" Command:"), firstLine)
color.HiYellowString(" Command:"), firstLine)
for _, line := range restLines {
fmt.Fprintf(color.Output, "%12s %s\n",
" ", line)
}
} else {
fmt.Fprintf(color.Output, "%12s %s\n",
color.YellowString(" Command:"), snippet.Command)
color.HiYellowString(" Command:"), snippet.Command)
}
if snippet.Tag != nil {
tag := strings.Join(snippet.Tag, " ")
fmt.Fprintf(color.Output, "%12s %s\n",
color.CyanString(" Tag:"), tag)
color.HiCyanString(" Tag:"), tag)
}
if snippet.Output != "" {
output := strings.Replace(snippet.Output, "\n", "\n ", -1)
fmt.Fprintf(color.Output, "%12s %s\n",
color.RedString(" Output:"), output)
color.HiRedString(" Output:"), output)
}
fmt.Println(strings.Repeat("-", 30))
}
Expand Down
8 changes: 4 additions & 4 deletions cmd/new.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,21 +87,21 @@ func new(cmd *cobra.Command, args []string) (err error) {

if len(args) > 0 {
command = strings.Join(args, " ")
fmt.Fprintf(color.Output, "%s %s\n", color.YellowString("Command>"), command)
fmt.Fprintf(color.Output, "%s %s\n", color.HiYellowString("Command>"), command)
} else {
command, err = scan(color.YellowString("Command> "), os.Stdout, os.Stdin, false)
command, err = scan(color.HiYellowString("Command> "), os.Stdout, os.Stdin, false)
if err != nil {
return err
}
}
description, err = scan(color.GreenString("Description> "), os.Stdout, os.Stdin, false)
description, err = scan(color.HiGreenString("Description> "), os.Stdout, os.Stdin, false)
if err != nil {
return err
}

if config.Flag.Tag {
var t string
if t, err = scan(color.CyanString("Tag> "), os.Stdout, os.Stdin, true); err != nil {
if t, err = scan(color.HiCyanString("Tag> "), os.Stdout, os.Stdin, true); err != nil {
return err
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func filter(options []string, tag string) (commands []string, err error) {
snippetTexts[t] = s
if config.Flag.Color {
t = fmt.Sprintf("[%s]: %s%s",
color.RedString(s.Description), command, color.BlueString(tags))
color.HiRedString(s.Description), command, color.HiCyanString(tags))
}
text += t + "\n"
}
Expand Down
2 changes: 1 addition & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func (cfg *Config) Load(file string) error {
}
}
cfg.General.Column = 40
cfg.General.SelectCmd = "fzf"
cfg.General.SelectCmd = "fzf --ansi --layout=reverse --border --height=90% --pointer='*' --cycle --prompt='Snippets: '"
cfg.General.Backend = "gist"

cfg.Gist.FileName = "pet-snippet.toml"
Expand Down

0 comments on commit 6d0fa33

Please sign in to comment.