command/build: -color [GH-1433]
This commit is contained in:
parent
b085c1d934
commit
c6243a2de7
|
@ -15,8 +15,6 @@ FEATURES:
|
||||||
Packer will look in the PWD and the directory with `packer` for
|
Packer will look in the PWD and the directory with `packer` for
|
||||||
binaries named `packer-TYPE-NAME`.
|
binaries named `packer-TYPE-NAME`.
|
||||||
* builder/docker: Images can now be committed instead of exported. [GH-1198]
|
* builder/docker: Images can now be committed instead of exported. [GH-1198]
|
||||||
* builder/docker: Can now specify login credentials to pull images.
|
|
||||||
* builder/docker: Support mounting additional volumes. [GH-1430]
|
|
||||||
* builder/virtualbox-ovf: New `import_flags` setting can be used to add
|
* builder/virtualbox-ovf: New `import_flags` setting can be used to add
|
||||||
new command line flags to `VBoxManage import` to allow things such
|
new command line flags to `VBoxManage import` to allow things such
|
||||||
as EULAs to be accepted. [GH-1383]
|
as EULAs to be accepted. [GH-1383]
|
||||||
|
@ -25,7 +23,6 @@ FEATURES:
|
||||||
* builder/vmware: VMware Player 6 is now supported. [GH-1168]
|
* builder/vmware: VMware Player 6 is now supported. [GH-1168]
|
||||||
* builder/vmware-vmx: Boot commands and the HTTP server are supported.
|
* builder/vmware-vmx: Boot commands and the HTTP server are supported.
|
||||||
[GH-1169]
|
[GH-1169]
|
||||||
* post-processor/docker-push: Can now specify login credentials. [GH-1243]
|
|
||||||
|
|
||||||
IMPROVEMENTS:
|
IMPROVEMENTS:
|
||||||
|
|
||||||
|
@ -37,6 +34,8 @@ IMPROVEMENTS:
|
||||||
* builder/amazon-instance: EBS AMIs can be used as a source. [GH-1453]
|
* builder/amazon-instance: EBS AMIs can be used as a source. [GH-1453]
|
||||||
* builder/digitalocean: Can set API URL endpoint. [GH-1448]
|
* builder/digitalocean: Can set API URL endpoint. [GH-1448]
|
||||||
* builder/digitalocean: Region supports variables. [GH-1452]
|
* builder/digitalocean: Region supports variables. [GH-1452]
|
||||||
|
* builder/docker: Can now specify login credentials to pull images.
|
||||||
|
* builder/docker: Support mounting additional volumes. [GH-1430]
|
||||||
* builder/parallels/all: Path to tools ISO is calculated automatically. [GH-1455]
|
* builder/parallels/all: Path to tools ISO is calculated automatically. [GH-1455]
|
||||||
* builder/parallels-pvm: `reassign_mac` option to choose wehther or not
|
* builder/parallels-pvm: `reassign_mac` option to choose wehther or not
|
||||||
to generate a new MAC address. [GH-1461]
|
to generate a new MAC address. [GH-1461]
|
||||||
|
@ -44,6 +43,8 @@ IMPROVEMENTS:
|
||||||
* builder/qemu: Can specify "tcg" acceleration type. [GH-1395]
|
* builder/qemu: Can specify "tcg" acceleration type. [GH-1395]
|
||||||
* builder/virtualbox/all: `iso_interface` option to mount ISO with SATA. [GH-1200]
|
* builder/virtualbox/all: `iso_interface` option to mount ISO with SATA. [GH-1200]
|
||||||
* builder/vmware-vmx: Proper `floppy_files` support. [GH-1057]
|
* builder/vmware-vmx: Proper `floppy_files` support. [GH-1057]
|
||||||
|
* command/build: Add `-color=false` flag to disable color. [GH-1433]
|
||||||
|
* post-processor/docker-push: Can now specify login credentials. [GH-1243]
|
||||||
|
|
||||||
BUG FIXES:
|
BUG FIXES:
|
||||||
|
|
||||||
|
|
|
@ -21,13 +21,12 @@ func (Command) Help() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c Command) Run(env packer.Environment, args []string) int {
|
func (c Command) Run(env packer.Environment, args []string) int {
|
||||||
var cfgDebug bool
|
var cfgColor, cfgDebug, cfgForce, cfgParallel bool
|
||||||
var cfgForce bool
|
|
||||||
var cfgParallel bool
|
|
||||||
buildOptions := new(cmdcommon.BuildOptions)
|
buildOptions := new(cmdcommon.BuildOptions)
|
||||||
|
|
||||||
cmdFlags := flag.NewFlagSet("build", flag.ContinueOnError)
|
cmdFlags := flag.NewFlagSet("build", flag.ContinueOnError)
|
||||||
cmdFlags.Usage = func() { env.Ui().Say(c.Help()) }
|
cmdFlags.Usage = func() { env.Ui().Say(c.Help()) }
|
||||||
|
cmdFlags.BoolVar(&cfgColor, "color", true, "enable or disable color")
|
||||||
cmdFlags.BoolVar(&cfgDebug, "debug", false, "debug mode for builds")
|
cmdFlags.BoolVar(&cfgDebug, "debug", false, "debug mode for builds")
|
||||||
cmdFlags.BoolVar(&cfgForce, "force", false, "force a build if artifacts exist")
|
cmdFlags.BoolVar(&cfgForce, "force", false, "force a build if artifacts exist")
|
||||||
cmdFlags.BoolVar(&cfgParallel, "parallel", true, "enable/disable parallelization")
|
cmdFlags.BoolVar(&cfgParallel, "parallel", true, "enable/disable parallelization")
|
||||||
|
@ -95,10 +94,14 @@ func (c Command) Run(env packer.Environment, args []string) int {
|
||||||
|
|
||||||
buildUis := make(map[string]packer.Ui)
|
buildUis := make(map[string]packer.Ui)
|
||||||
for i, b := range builds {
|
for i, b := range builds {
|
||||||
ui := &packer.ColoredUi{
|
var ui packer.Ui
|
||||||
|
ui = env.Ui()
|
||||||
|
if cfgColor {
|
||||||
|
ui = &packer.ColoredUi{
|
||||||
Color: colors[i%len(colors)],
|
Color: colors[i%len(colors)],
|
||||||
Ui: env.Ui(),
|
Ui: env.Ui(),
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
buildUis[b.Name()] = ui
|
buildUis[b.Name()] = ui
|
||||||
ui.Say(fmt.Sprintf("%s output will be in this color.", b.Name()))
|
ui.Say(fmt.Sprintf("%s output will be in this color.", b.Name()))
|
||||||
|
|
|
@ -12,6 +12,8 @@ artifacts that are created will be outputted at the end of the build.
|
||||||
|
|
||||||
## Options
|
## Options
|
||||||
|
|
||||||
|
* `-color=false` - Disables colorized output. Enabled by default.
|
||||||
|
|
||||||
* `-debug` - Disables parallelization and enables debug mode. Debug mode flags
|
* `-debug` - Disables parallelization and enables debug mode. Debug mode flags
|
||||||
the builders that they should output debugging information. The exact behavior
|
the builders that they should output debugging information. The exact behavior
|
||||||
of debug mode is left to the builder. In general, builders usually will stop
|
of debug mode is left to the builder. In general, builders usually will stop
|
||||||
|
|
Loading…
Reference in New Issue