示例#1
0
文件: cfprint.go 项目: sqp/godock
// Default prints the configuration compared to its default values.
//
func Default(build cftype.Builder, showAll bool) {
	cols := []tablist.ColInfo{
		tablist.NewColLeft(0, "Type"),
		tablist.NewColLeft(0, "Name"),
	}

	if showAll {
		cols = append(cols,
			tablist.NewColLeft(0, "Default"),
		)
	}
	cols = append(cols,
		tablist.NewColLeft(0, "Current"),
	)

	lf := &lineFeed{
		TableFormater: *tablist.NewFormater(cols...),
	}
	if showAll {
		lf.valuePrint = lf.valueDefault
		build.KeyWalk(lf.Add)
	} else {
		build.KeyWalk(lf.addTest)
	}

	lf.Print()

	if lf.countChanged > 0 {
		build.Log().Info("changed", lf.countChanged, "/", lf.countChangeable)
	} else {
		build.Log().Info("nothing changed")
	}
}
示例#2
0
文件: cfprint.go 项目: sqp/godock
// Updated prints the configuration compared to its storage values.
//
func Updated(build cftype.Builder) {
	// build.Log().DEV("save to virtual")
	lf := &lineFeed{
		TableFormater: *tablist.NewFormater(
			tablist.NewColLeft(0, "Type"),
			tablist.NewColLeft(0, "Name"),
			tablist.NewColLeft(0, "Old value"),
			tablist.NewColLeft(0, "New value"),
		),
	}
	lf.valuePrint = lf.valueUpdated

	build.KeyWalk(lf.Add)
	lf.Print()

	if lf.countChanged > 0 {
		build.Log().Info("changed", lf.countChanged, "/", lf.countChangeable)
	} else {
		build.Log().Info("nothing changed")
	}
}