-
Notifications
You must be signed in to change notification settings - Fork 0
/
root.go
39 lines (32 loc) · 1.14 KB
/
root.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package cmd
import (
"path/filepath"
"github.com/spf13/cobra"
)
var (
romsFolder string
backgroundsFolder string
foregroundsFolder string
rootCmd = &cobra.Command{
Use: "azpiri",
Short: "A launching images generator for RetroPie",
Long: `Azpiri is a CLI application that will create launching images
for games stored in a roms folder, using PNG images
with the same name as the ROM in the specified artwork folders`,
Run: func(cmd *cobra.Command, args []string) {
process()
},
}
)
// Execute executes the root command.
func Execute() error {
return rootCmd.Execute()
}
func init() {
rootCmd.PersistentFlags().StringVarP(&romsFolder, "roms", "r", ".", "Roms folder to scan")
romsFolder = filepath.Clean(romsFolder)
rootCmd.PersistentFlags().StringVarP(&backgroundsFolder, "backgrounds", "b", romsFolder+"/media/screenshots/", "Background images folder to scan")
rootCmd.PersistentFlags().StringVarP(&foregroundsFolder, "foregrounds", "f", romsFolder+"/media/marquees/", "Foreground images folder to scan")
backgroundsFolder = filepath.Clean(backgroundsFolder)
foregroundsFolder = filepath.Clean(foregroundsFolder)
}