mirror of
https://github.com/yarlson/lnk.git
synced 2025-08-30 17:59:47 +02:00
refactor(cmd): centralize output formatting with printf helper function
This commit is contained in:
22
cmd/init.go
22
cmd/init.go
@@ -22,18 +22,18 @@ func newInitCmd() *cobra.Command {
|
||||
}
|
||||
|
||||
if remote != "" {
|
||||
_, _ = fmt.Fprintf(cmd.OutOrStdout(), "🎯 \033[1mInitialized lnk repository\033[0m\n")
|
||||
_, _ = fmt.Fprintf(cmd.OutOrStdout(), " 📦 Cloned from: \033[36m%s\033[0m\n", remote)
|
||||
_, _ = fmt.Fprintf(cmd.OutOrStdout(), " 📁 Location: \033[90m~/.config/lnk\033[0m\n")
|
||||
_, _ = fmt.Fprintf(cmd.OutOrStdout(), "\n💡 \033[33mNext steps:\033[0m\n")
|
||||
_, _ = fmt.Fprintf(cmd.OutOrStdout(), " • Run \033[1mlnk pull\033[0m to restore symlinks\n")
|
||||
_, _ = fmt.Fprintf(cmd.OutOrStdout(), " • Use \033[1mlnk add <file>\033[0m to manage new files\n")
|
||||
printf(cmd, "🎯 \033[1mInitialized lnk repository\033[0m\n")
|
||||
printf(cmd, " 📦 Cloned from: \033[36m%s\033[0m\n", remote)
|
||||
printf(cmd, " 📁 Location: \033[90m~/.config/lnk\033[0m\n")
|
||||
printf(cmd, "\n💡 \033[33mNext steps:\033[0m\n")
|
||||
printf(cmd, " • Run \033[1mlnk pull\033[0m to restore symlinks\n")
|
||||
printf(cmd, " • Use \033[1mlnk add <file>\033[0m to manage new files\n")
|
||||
} else {
|
||||
_, _ = fmt.Fprintf(cmd.OutOrStdout(), "🎯 \033[1mInitialized empty lnk repository\033[0m\n")
|
||||
_, _ = fmt.Fprintf(cmd.OutOrStdout(), " 📁 Location: \033[90m~/.config/lnk\033[0m\n")
|
||||
_, _ = fmt.Fprintf(cmd.OutOrStdout(), "\n💡 \033[33mNext steps:\033[0m\n")
|
||||
_, _ = fmt.Fprintf(cmd.OutOrStdout(), " • Run \033[1mlnk add <file>\033[0m to start managing dotfiles\n")
|
||||
_, _ = fmt.Fprintf(cmd.OutOrStdout(), " • Add a remote with: \033[1mgit remote add origin <url>\033[0m\n")
|
||||
printf(cmd, "🎯 \033[1mInitialized empty lnk repository\033[0m\n")
|
||||
printf(cmd, " 📁 Location: \033[90m~/.config/lnk\033[0m\n")
|
||||
printf(cmd, "\n💡 \033[33mNext steps:\033[0m\n")
|
||||
printf(cmd, " • Run \033[1mlnk add <file>\033[0m to start managing dotfiles\n")
|
||||
printf(cmd, " • Add a remote with: \033[1mgit remote add origin <url>\033[0m\n")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
Reference in New Issue
Block a user