This adds more logging in certain places, and adds logging to the CLI. It also allows for certain commands in the CLI to be used without a daemon connection, namely `init`, which previously required the daemon to be connected, but now does not since it doesnt need it.
23 lines
509 B
Go
23 lines
509 B
Go
package commands
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
util "github.com/juls0730/flux/internal/util/cli"
|
|
)
|
|
|
|
func StopCommand(ctx CommandCtx, args []string) error {
|
|
projectName, err := util.GetProject("stop", args, ctx.Config, ctx.Logger)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
err = util.PutRequest(ctx.Config.DaemonURL+"/app/"+projectName.Id+"/stop", nil, ctx.Logger)
|
|
if err != nil {
|
|
return fmt.Errorf("failed to stop %s: %v", projectName.Name, err)
|
|
}
|
|
|
|
fmt.Printf("Successfully stopped %s\n", projectName.Name)
|
|
return nil
|
|
}
|