Golang Fileparameter
A simple Go module to get filenames from a CLI input.
Features
- Wildcard Support (like this
*.mp3
bill-*.pdf
)
- Validates if the file truly exists
- Create a slice containing valid filenames for processing
Example explained
Execution of a CLI application
./myapp ~/Music/*.mp3
Result generated by the function (Go slice)
beethoven_symphony9.mp3
mozart_requiem.mp3
bach_brandenburg_concerto.mp3
Example Code
package main
import (
"fmt"
"os"
"codeberg.org/berzdev/go-fileparameter"
)
func main() {
files, err := fileparameter.GetFiles()
if err != nil {
fmt.Println("Error:", err)
os.Exit(1)
}
for _, v := range files {
fmt.Println(v)
}
}