Skip to content

Commit

Permalink
Merge pull request #6 from ondrovic/dev
Browse files Browse the repository at this point in the history
Updates and Refactors
  • Loading branch information
ondrovic authored Nov 1, 2024
2 parents bd80aeb + 927a66c commit 81921a2
Show file tree
Hide file tree
Showing 9 changed files with 186 additions and 103 deletions.
3 changes: 0 additions & 3 deletions TODO

This file was deleted.

25 changes: 25 additions & 0 deletions cmd/cli/check.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package cli

import (
"github.com/ondrovic/video-organizer/internal/video"
"github.com/spf13/cobra"
)

var (
checkCmd = &cobra.Command{
Use: "check <directory>",
Short: "Check a directory to see if it's been organized",
Args: cobra.ExactArgs(1),
RunE: runCheck,
}
)

func runCheck(cmd *cobra.Command, args []string) error {
options.Directory = video.FormatDirectory(args[0])

if err := video.CheckDirectories(options.Directory); err != nil {
return err
}

return nil
}
14 changes: 3 additions & 11 deletions cmd/cli/organize.go
Original file line number Diff line number Diff line change
@@ -1,28 +1,20 @@
package cli

import (
"github.com/ondrovic/video-organizer/internal/types"
"github.com/ondrovic/video-organizer/internal/video"
"github.com/spf13/cobra"
)

var (
options = types.CliFlags{}
organizeCmd = &cobra.Command{}
)

func init() {
organizeCmd = &cobra.Command{
Use: "organize <directory>",
Short: "Organize the directory",
Args: cobra.ExactArgs(1),
RunE: run,
RunE: runOrganize,
}
)

RootCmd.AddCommand(organizeCmd)
}

func run(cmd *cobra.Command, args []string) error {
func runOrganize(cmd *cobra.Command, args []string) error {
options.Directory = video.FormatDirectory(args[0])

if err := video.OrganizeVideos(options.Directory); err != nil {
Expand Down
15 changes: 12 additions & 3 deletions cmd/cli/root.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
package cli

import (
"github.com/ondrovic/video-organizer/internal/types"
"github.com/spf13/cobra"
)

var RootCmd = &cobra.Command{
Use: "video-organizer",
Short: "A CLI tool to organize videos by duration",
var (
options = types.CliFlags{}
RootCmd = &cobra.Command{
Use: "video-organizer",
Short: "A CLI tool to organize videos by duration",
}
)

func InitializeCommands() {
RootCmd.AddCommand(checkCmd)
RootCmd.AddCommand(organizeCmd)
}

func Execute() error {
Expand Down
31 changes: 15 additions & 16 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,39 +14,38 @@ require (
atomicgo.dev/cursor v0.2.0 // indirect
atomicgo.dev/keyboard v0.2.9 // indirect
atomicgo.dev/schedule v0.1.0 // indirect
dario.cat/mergo v1.0.1 // indirect
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver/v3 v3.2.0 // indirect
github.com/Masterminds/sprig/v3 v3.2.3 // indirect
github.com/Masterminds/semver/v3 v3.3.0 // indirect
github.com/Masterminds/sprig/v3 v3.3.0 // indirect
github.com/araddon/dateparse v0.0.0-20210429162001-6b43995a97de // indirect
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
github.com/containerd/console v1.0.4 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/fatih/color v1.13.0 // indirect
github.com/goccy/go-yaml v1.11.0 // indirect
github.com/google/uuid v1.1.1 // indirect
github.com/fatih/color v1.18.0 // indirect
github.com/goccy/go-yaml v1.13.2 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/gookit/color v1.5.4 // indirect
github.com/hashicorp/go-version v1.6.0 // indirect
github.com/hashicorp/go-version v1.7.0 // indirect
github.com/hokaccha/go-prettyjson v0.0.0-20211117102719-0474bc63780f // indirect
github.com/huandu/xstrings v1.3.3 // indirect
github.com/imdario/mergo v0.3.11 // indirect
github.com/huandu/xstrings v1.5.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/lithammer/fuzzysearch v1.1.8 // indirect
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.18 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.16 // indirect
github.com/mitchellh/copystructure v1.0.0 // indirect
github.com/mitchellh/reflectwalk v1.0.0 // indirect
github.com/muesli/termenv v0.15.1 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/muesli/termenv v0.15.2 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/shopspring/decimal v1.2.0 // indirect
github.com/spf13/cast v1.3.1 // indirect
github.com/shopspring/decimal v1.4.0 // indirect
github.com/spf13/cast v1.7.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
golang.org/x/crypto v0.7.0 // indirect
golang.org/x/crypto v0.28.0 // indirect
golang.org/x/sys v0.26.0 // indirect
golang.org/x/term v0.25.0 // indirect
golang.org/x/text v0.19.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit 81921a2

Please sign in to comment.