feat: initial Lnk CLI implementation

This commit is contained in:
Yar Kravtsov
2025-05-24 06:17:52 +03:00
commit 9088bbda50
13 changed files with 941 additions and 0 deletions

26
cmd/init.go Normal file
View File

@@ -0,0 +1,26 @@
package cmd
import (
"fmt"
"github.com/spf13/cobra"
"github.com/yarlson/lnk/internal/core"
)
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.",
RunE: func(cmd *cobra.Command, args []string) error {
lnk := core.NewLnk()
if err := lnk.Init(); err != nil {
return fmt.Errorf("failed to initialize lnk: %w", err)
}
fmt.Println("Initialized lnk repository")
return nil
},
}
func init() {
rootCmd.AddCommand(initCmd)
}