cspj-application/server/internal/cli/cli.go

25 lines
463 B
Go
Raw Normal View History

2025-02-13 02:44:44 +08:00
package cli
import (
"flag"
"fmt"
"os"
"github.com/Vomitblood/cspj-application/server/internal/config"
)
func GetFlags() {
logDir := flag.String("l", "", "Path to the log directory")
flag.Parse()
// check if the -l flag is provided
if flag.Lookup("l").Value.String() == "" {
fmt.Println("Error: The -l flag (log directory) is required.")
os.Exit(1)
}
// store the value in a globally accessible config package
config.LogDirectory = *logDir
}