Skip to content

Commit

Permalink
Adjust root command's code for adding subcommand
Browse files Browse the repository at this point in the history
  • Loading branch information
tsunejui committed Aug 28, 2021
1 parent 57d8c31 commit 6bca38c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
9 changes: 5 additions & 4 deletions cmd/merge.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
)

var (
MergeCommand = &cobra.Command{
mergeCommand = &cobra.Command{
Use: "merge",
Short: "Merge the images from the specified folders",
Long: `Merge the images from the specified folders`,
Expand All @@ -29,9 +29,10 @@ var (
)

func init() {
MergeCommand.Flags().StringSliceVarP(&folders, "directory", "d", []string{}, "specify a directory")
MergeCommand.Flags().StringVarP(&rootDirectory, "root", "D", "", "specify the root directory")
MergeCommand.Flags().StringVarP(&output, "out", "o", "", "export the images")
rootCmd.AddCommand(mergeCommand)
mergeCommand.Flags().StringSliceVarP(&folders, "directory", "d", []string{}, "specify a directory")
mergeCommand.Flags().StringVarP(&rootDirectory, "root", "D", "", "specify the root directory")
mergeCommand.Flags().StringVarP(&output, "out", "o", "", "export the images")
}

type MergeImages struct {
Expand Down
4 changes: 0 additions & 4 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ var (
}
)

func init() {
rootCmd.AddCommand(MergeCommand)
}

func Execute() error {
return rootCmd.Execute()
}

0 comments on commit 6bca38c

Please sign in to comment.