From aba7ce588eedd130568e800cd779b956e7303a07 Mon Sep 17 00:00:00 2001 From: Shahryar Tayeb Date: Wed, 15 Nov 2023 15:21:41 +0430 Subject: [PATCH] added functionality back --- .goreleaser.yaml | 2 +- cmd/root.go | 34 +++++++++++++++++----------------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index cdabdaa..3655c9a 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -20,7 +20,7 @@ archives: - id: nix builds: [macos, linux] <<: &archive_defaults - name_template: "name_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}" + name_template: "organizer_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}" wrap_in_directory: true format: tar.gz files: diff --git a/cmd/root.go b/cmd/root.go index f14bfdc..53a238c 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -2,40 +2,40 @@ package cmd import ( "fmt" + "log" "os" + "github.com/shtayeb/go-organizer/cmd/organizers" "github.com/spf13/cobra" ) // rootCmd represents the base command when called without any subcommands var rootCmd = &cobra.Command{ Use: "organizer", - Version: "0.1.0", + Version: "0.1.1", Short: "A CLI app to organize your files into folders according to their extensions.", Run: func(cmd *cobra.Command, args []string) { - fmt.Println("Hello World!") + path, _ := os.Getwd() - // path, _ := os.Getwd() + // Get list of files in the working directory + entries, err := os.ReadDir(path) - // // Get list of files in the working directory - // entries, err := os.ReadDir(path) + if err != nil { + log.Fatal(err) + } - // if err != nil { - // log.Fatal(err) - // } + for _, entry := range entries { + if entry.IsDir() { + continue + } - // for _, entry := range entries { - // if entry.IsDir() { - // continue - // } + fullFileName := entry.Name() + organizers.OrganizeFiles(path, fullFileName) - // fullFileName := entry.Name() - // organizers.OrganizeFiles(path, fullFileName) + } - // } - - // fmt.Printf("Program run !") + fmt.Printf("Organizer Finished Execution !") }, }