mirror of
https://github.com/yarlson/lnk.git
synced 2025-09-01 18:02:34 +02:00
feat: enhance CLI output with colorful and informative messages
This commit is contained in:
20
cmd/init.go
20
cmd/init.go
@@ -8,9 +8,10 @@ import (
|
||||
)
|
||||
|
||||
var initCmd = &cobra.Command{
|
||||
Use: "init",
|
||||
Short: "Initialize a new lnk repository",
|
||||
Long: "Creates the lnk directory and initializes a Git repository for managing dotfiles.",
|
||||
Use: "init",
|
||||
Short: "🎯 Initialize a new lnk repository",
|
||||
Long: "Creates the lnk directory and initializes a Git repository for managing dotfiles.",
|
||||
SilenceUsage: true,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
remote, _ := cmd.Flags().GetString("remote")
|
||||
|
||||
@@ -20,9 +21,18 @@ var initCmd = &cobra.Command{
|
||||
}
|
||||
|
||||
if remote != "" {
|
||||
fmt.Printf("Initialized lnk repository by cloning: %s\n", remote)
|
||||
fmt.Printf("🎯 \033[1mInitialized lnk repository\033[0m\n")
|
||||
fmt.Printf(" 📦 Cloned from: \033[36m%s\033[0m\n", remote)
|
||||
fmt.Printf(" 📁 Location: \033[90m~/.config/lnk\033[0m\n")
|
||||
fmt.Printf("\n💡 \033[33mNext steps:\033[0m\n")
|
||||
fmt.Printf(" • Run \033[1mlnk pull\033[0m to restore symlinks\n")
|
||||
fmt.Printf(" • Use \033[1mlnk add <file>\033[0m to manage new files\n")
|
||||
} else {
|
||||
fmt.Println("Initialized lnk repository")
|
||||
fmt.Printf("🎯 \033[1mInitialized empty lnk repository\033[0m\n")
|
||||
fmt.Printf(" 📁 Location: \033[90m~/.config/lnk\033[0m\n")
|
||||
fmt.Printf("\n💡 \033[33mNext steps:\033[0m\n")
|
||||
fmt.Printf(" • Run \033[1mlnk add <file>\033[0m to start managing dotfiles\n")
|
||||
fmt.Printf(" • Add a remote with: \033[1mgit remote add origin <url>\033[0m\n")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
Reference in New Issue
Block a user