packer-cn/command
Wilken Rivera acabc1c1aa
Add packer fmt command (#10225)
* Add packer fmt command

This change adds a new command that allows users to format one or more
HCL2 Packer configuration template files.

Related to: #9174

* command/fmt: Add check flag

Packer's fmt command now supports a check flag that will output the name
of any file that would be changed by the HCL2 formatting engine. The
check flag is mutually exclusive with the write flag and will only check
if formatting is needed.

The update write flag will now overwrite the source files with the newly
formatted HCL2 source unless the `-write=false` or `-check` is passed at
the command line.

* Returns a diagnostic error if Format is unable to show a diff - equivalent to `terraform fmt`
* Updates testing to run against #Format and not the private methods of the HCL2Formatter; fixes ShowDiff test failure on Windows
* Updates comments for exported functions

* Add docs for fmt command
2020-11-11 11:49:39 -05:00
..
test-fixtures HCL2: allow calling env as input var default value (#10240) 2020-11-11 11:27:32 +01:00
build.go docs tweaks 2020-10-14 12:58:04 -07:00
build_cancellation_test.go fix tests 2020-05-08 17:46:33 +02:00
build_cleanup_script_test.go fix tests 2020-05-08 17:46:33 +02:00
build_parallel_test.go fix tests 2020-05-08 17:46:33 +02:00
build_test.go add command/ tests 2020-11-02 15:50:38 +01:00
build_timeout_test.go build using HCL2 (#8423) 2019-12-17 11:25:56 +01:00
build_windows_test.go Update build_windows_test.go 2020-07-07 12:00:36 +02:00
cli.go Add packer fmt command (#10225) 2020-11-11 11:49:39 -05:00
command_test.go add tests 2020-10-02 10:49:21 +02:00
configtype_enumer.go packer console for HCL2 (#9359) 2020-06-05 17:23:54 +02:00
console.go docs tweaks 2020-10-14 12:58:04 -07:00
console_test.go console: allow to use console when there are untyped vars (#9864) 2020-09-02 17:19:56 +02:00
core_wrapper.go refactor initialization out from packer configs + tests (#9627) 2020-07-24 10:58:03 +02:00
exec_test.go JSON to HCL2 (minimal best-effort) transpiler (#9659) 2020-08-25 10:51:43 +02:00
fix.go update fix command with new synthax 2020-05-12 11:33:44 +02:00
fix_test.go Move fixer test to fix package 2019-07-24 18:04:17 +01:00
fmt.go Add packer fmt command (#10225) 2020-11-11 11:49:39 -05:00
hcl2_upgrade.go hcl2_upgrade update (#10221) 2020-11-10 10:46:20 +01:00
hcl2_upgrade_test.go JSON to HCL2 (minimal best-effort) transpiler (#9659) 2020-08-25 10:51:43 +02:00
inspect.go inspect command: ignore init errors as some value can be unset 2020-09-01 11:59:07 +02:00
inspect_test.go HCL2: allow calling env as input var default value (#10240) 2020-11-11 11:27:32 +01:00
meta.go JSON to HCL2 (minimal best-effort) transpiler (#9659) 2020-08-25 10:51:43 +02:00
plugin.go [proxmox] add proxmox builder alias 2020-10-07 23:43:12 -07:00
signal.go refactor term interrupts & have RunContext take a conf struct now 2020-05-08 12:05:14 +02:00
utils.go build using HCL2 (#8423) 2019-12-17 11:25:56 +01:00
validate.go docs tweaks 2020-10-14 12:58:04 -07:00
validate_test.go HCL2: add a packer block with a required_version input setting (#10149) 2020-10-27 10:03:36 +01:00
version.go packer.io prefix removal, html extension remove for in-code errors 2020-04-07 17:53:22 -04:00
version_test.go command: version tests 2014-10-27 20:58:44 -07:00