-
-
Notifications
You must be signed in to change notification settings - Fork 579
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Rename stop command to stop-containers * Rename remove command to stop * Change behavior of ddev restart to Stop and Start * Rename app.Down() to app.Stop() * Make 'stop' the lead command, rm or remove an additional alias * Add 'ddev sc' alias for stop-containers * Fix docs to use 'stop' by default instead of 'remove'
- Loading branch information
Showing
29 changed files
with
249 additions
and
255 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/drud/ddev/pkg/ddevapp" | ||
"github.com/drud/ddev/pkg/util" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var stopAllContainers bool | ||
|
||
// DdevStopContainersCmd represents the stop command | ||
var DdevStopContainersCmd = &cobra.Command{ | ||
Use: "stop-containers [projectname ...]", | ||
Short: "uses 'docker stop' to stop the containers belonging to a project.", | ||
Long: `Uses "docker-compose stop" to stop the containers belonging to a project. This leaves the containers instantiated instead of removing them like ddev stop does. You can run 'ddev stop-containers' | ||
from a project directory to stop the containers of that project, or you can stop running projects | ||
in any directory by running 'ddev stop-containers projectname [projectname ...]'`, | ||
Aliases: []string{"sc"}, | ||
Run: func(cmd *cobra.Command, args []string) { | ||
projects, err := getRequestedProjects(args, stopAllContainers) | ||
if err != nil { | ||
util.Failed("Unable to get project(s): %v", err) | ||
} | ||
|
||
for _, project := range projects { | ||
if err := ddevapp.CheckForMissingProjectFiles(project); err != nil { | ||
util.Failed("Failed to stop-containers %s: %v", project.GetName(), err) | ||
} | ||
|
||
if err := project.StopContainers(); err != nil { | ||
util.Failed("Failed to stop-containers %s: %v", project.GetName(), err) | ||
} | ||
|
||
util.Success("Containers for project %s have been stopped.", project.GetName()) | ||
} | ||
}, | ||
} | ||
|
||
func init() { | ||
DdevStopContainersCmd.Flags().BoolVarP(&stopAllContainers, "all", "a", false, "Stop-containers on all running projects") | ||
RootCmd.AddCommand(DdevStopContainersCmd) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.