22
22
23
23
func main () {
24
24
// Parse command-line arguments
25
- flag .StringVar (& inputPath , "input" , "" , "Path to the input file" )
25
+ flag .StringVar (& inputPath , "input" , "" , "Path to the input file / directory " )
26
26
flag .StringVar (& outputPath , "output" , "" , "Path to the output file (optional)" )
27
27
flag .StringVar (& format , "format" , "png" , "Output format" )
28
28
flag .IntVar (& width , "width" , 32 , "Image width" )
@@ -38,13 +38,6 @@ func main() {
38
38
os .Exit (1 )
39
39
}
40
40
41
- // Check if the index flag was set
42
- flag .Visit (func (f * flag.Flag ) {
43
- if f .Name == "index" {
44
- indexSet = true
45
- }
46
- })
47
-
48
41
// Derive output path if not provided
49
42
if outputPath == "" {
50
43
baseName := strings .TrimSuffix (filepath .Base (inputPath ), filepath .Ext (inputPath ))
@@ -58,6 +51,26 @@ func main() {
58
51
os .Exit (1 )
59
52
}
60
53
defer outputFile .Close ()
54
+
55
+ // Get information from GetInfo function
56
+ info , err := fico .GetInfo (inputPath )
57
+ if err != nil {
58
+ fmt .Printf ("Error getting info: %v\n " , err )
59
+ os .Exit (1 )
60
+ }
61
+
62
+ // Use retrieved information
63
+ if info .IconIndex != nil {
64
+ index = * info .IconIndex
65
+ indexSet = true
66
+ }
67
+
68
+ // Check if the index flag was set
69
+ flag .Visit (func (f * flag.Flag ) {
70
+ if f .Name == "index" {
71
+ indexSet = true
72
+ }
73
+ })
61
74
62
75
// Prepare configuration
63
76
var indexPtr * int
0 commit comments