package main

import (
	"errors"
	"flag"
	"fmt"
	"os"
)

func main() {
	configPath := flag.String("config", "/etc/samba/smb.conf", "path to smb.conf")
	flag.Parse()

	app := NewApp(*configPath, RealUserManager{}, OSCommandRunner{}, execLookPath)
	if err := app.Run(); err != nil {
		if errors.Is(err, ErrCancelled) {
			fmt.Fprintln(os.Stderr, "cancelled")
			os.Exit(1)
		}

		fmt.Fprintf(os.Stderr, "error: %v\n", err)
		os.Exit(1)
	}
}
