GODT-2013: CLI flag for frontend is required (v3)

This commit is contained in:
James Houlahan
2022-11-04 01:10:23 +01:00
parent f8d7b98d05
commit 8b5cb7729c
3 changed files with 26 additions and 8 deletions

View File

@ -27,6 +27,7 @@ import (
"github.com/ProtonMail/proton-bridge/v2/internal/frontend/grpc"
"github.com/ProtonMail/proton-bridge/v2/internal/locations"
"github.com/ProtonMail/proton-bridge/v2/pkg/restarter"
"github.com/sirupsen/logrus"
"github.com/urfave/cli/v2"
)
@ -45,12 +46,19 @@ func runFrontend(
case c.Bool(flagNonInteractive):
select {}
default:
case c.Bool(flagGRPC):
service, err := grpc.NewService(crashHandler, restarter, locations, bridge, eventCh, !c.Bool(flagNoWindow))
if err != nil {
return fmt.Errorf("could not create service: %w", err)
}
return service.Loop()
default:
if err := cli.ShowAppHelp(c); err != nil {
logrus.WithError(err).Error("Failed to show app help")
}
return fmt.Errorf("no frontend specified, use --cli, --grpc or --noninteractive")
}
}