Skip to content

Commit 24cd61a

Browse files
authored
🚗 feat: add GetInfo
1 parent bfc8db8 commit 24cd61a

File tree

1 file changed

+21
-8
lines changed

1 file changed

+21
-8
lines changed

cmd/main.go

+21-8
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ var (
2222

2323
func main() {
2424
// 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")
2626
flag.StringVar(&outputPath, "output", "", "Path to the output file (optional)")
2727
flag.StringVar(&format, "format", "png", "Output format")
2828
flag.IntVar(&width, "width", 32, "Image width")
@@ -38,13 +38,6 @@ func main() {
3838
os.Exit(1)
3939
}
4040

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-
4841
// Derive output path if not provided
4942
if outputPath == "" {
5043
baseName := strings.TrimSuffix(filepath.Base(inputPath), filepath.Ext(inputPath))
@@ -58,6 +51,26 @@ func main() {
5851
os.Exit(1)
5952
}
6053
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+
})
6174

6275
// Prepare configuration
6376
var indexPtr *int

0 commit comments

Comments
 (0)