コード例 #1
0
ファイル: ls.go プロジェクト: liamjbennett/sous
func Ls(sous *core.Sous, args []string) {
	//globalFlag := lsFlags.Bool("g", false, "global: list files in all projects sous has built")
	//lsFlags.Parse(args)
	//global := *globalFlag
	args = lsFlags.Args()
	if len(args) != 0 {
		cli.Fatalf("sous ls does not accept any arguments")
	}
	_, context := sous.AssembleTargetContext("app")
	cli.Outf(" ===> Images")
	images := sous.LsImages(context)
	if len(images) == 0 {
		cli.Logf("  no images for this project")
	}
	for _, image := range images {
		cli.Logf("  %s:%s", image.Name, image.Tag)
	}
	cli.Outf(" ===> Containers")
	containers := sous.LsContainers(context)
	if len(containers) == 0 {
		cli.Logf("  no containers for this project")
	}
	for _, container := range containers {
		cli.Logf("  %s (%s)", container.Name(), container.CID())
	}
	cli.Success()
}
コード例 #2
0
ファイル: clean.go プロジェクト: liamjbennett/sous
func cleanContainers(sous *core.Sous, context *core.Context) bool {
	success := true
	for _, c := range sous.LsContainers(context) {
		if err := c.ForceRemove(); err != nil {
			cli.Logf("Failed to remove container %s (%s)", c.Name(), c.CID())
			success = false
		} else {
			cli.Logf("Removed container %s (%s)", c.Name(), c.CID())
		}
	}
	return success
}