forked from nanobox-io/nanobox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclean.go
39 lines (32 loc) · 842 Bytes
/
clean.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package commands
import (
"fmt"
"github.com/spf13/cobra"
"github.com/nanobox-io/nanobox/commands/steps"
"github.com/nanobox-io/nanobox/models"
"github.com/nanobox-io/nanobox/processors"
"github.com/nanobox-io/nanobox/util/display"
)
var (
// CleanCmd ...
CleanCmd = &cobra.Command{
Use: "clean",
Short: "Clean out any apps that no longer exist.",
Long: `
Clean out any apps whose working directory no longer exists. This
will remove all associated app information from your Nanobox database.
`,
PreRun: steps.Run("start"),
Run: cleanFn,
}
)
// cleanFn ...
func cleanFn(ccmd *cobra.Command, args []string) {
// get the environments
envs, err := models.AllEnvs()
if err != nil {
fmt.Printf("TODO: write message for command clean: %s\n", err.Error())
return
}
display.CommandErr(processors.Clean(envs))
}