Esempio n. 1
0
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()
}
Esempio n. 2
0
func cleanImages(sous *core.Sous, context *core.Context) bool {
	success := true
	for _, i := range sous.LsImages(context) {
		if err := i.Remove(); err != nil {
			cli.Logf("Failed to remove image %s:%s", i.Name, i.Tag)
			success = false
		} else {
			cli.Logf("Removed image %s:%s", i.Name, i.Tag)
		}
	}
	return success
}