allow client without server
This commit is contained in:
45
app.go
45
app.go
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user