fileparameter

package module
v0.0.0-...-3d6f83d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 18, 2025 License: MIT Imports: 3 Imported by: 0

README

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)
	}
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetFiles

func GetFiles() (out []string, err error)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL