feat: CLI-Skeleton mit version/serve/check und Makefile
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NBHF4R9EAejDJUMdwr6C68
This commit is contained in:
parent
bb84607bf8
commit
fbfff90b38
8 changed files with 196 additions and 0 deletions
25
cmd/vpnportal/serve.go
Normal file
25
cmd/vpnportal/serve.go
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"io"
|
||||
)
|
||||
|
||||
const defaultConfigPath = "/etc/vpnportal/config.yaml"
|
||||
|
||||
func configFlags(name string, stderr io.Writer) (*flag.FlagSet, *string) {
|
||||
fs := flag.NewFlagSet(name, flag.ContinueOnError)
|
||||
fs.SetOutput(stderr)
|
||||
path := fs.String("config", defaultConfigPath, "Pfad zur Konfigurationsdatei")
|
||||
return fs, path
|
||||
}
|
||||
|
||||
func runServe(args []string, stdout, stderr io.Writer) int {
|
||||
fs, path := configFlags("serve", stderr)
|
||||
if err := fs.Parse(args); err != nil {
|
||||
return 2
|
||||
}
|
||||
fmt.Fprintf(stderr, "Fehler: config %q kann noch nicht geladen werden (nicht implementiert)\n", *path)
|
||||
return 1
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue