allow client without server

This commit is contained in:
2026-03-19 19:48:18 +00:00
parent 93527bb725
commit c0ea7bf29e
2 changed files with 45 additions and 0 deletions

45
app.go
View File

@@ -87,6 +87,51 @@ func NewApp(configPath string, users UserManager, runner CommandRunner, lookPath
}
func (a *App) Run() error {
for {
choice, err := a.chooseStartupWorkflow()
if err != nil {
return err
}
switch choice {
case "server":
return a.runServerWorkflow()
case "client":
return a.setupClientMount()
case "quit":
return nil
}
}
}
func (a *App) chooseStartupWorkflow() (string, error) {
a.println("")
a.println("Samba setup assistant")
a.println("=====================")
a.println("[s] set up or edit shares on this computer")
a.println("[c] connect this computer to a share on another server")
a.println("[q] quit")
a.flush()
choice, err := a.prompt("What would you like to do")
if err != nil {
return "", err
}
switch strings.ToLower(choice) {
case "s", "server":
return "server", nil
case "c", "client":
return "client", nil
case "q", "quit":
return "quit", nil
default:
a.println("Unknown choice.")
return a.chooseStartupWorkflow()
}
}
func (a *App) runServerWorkflow() error {
doc, err := ParseConfigFile(a.configPath)
if err != nil {
if os.IsNotExist(err) {