Skip to content

Feature Req: Apply Canonical formatting  #8

@maroskukan

Description

@maroskukan

First of all, thanks for this plugin, it is awesome. I was wondering whether you could add a feature plugin command that could apply canonical file formatting.

Therefore taking for example:

data "amazon-ami" "amazon-linux-2" {
    filters = {
        name = "amzn2-ami-hvm-2.*-x86_64-gp2"
        root-device-type = "ebs"
        virtualization-type = "hvm"
    }
    most_recent = true
    owners = ["amazon"]
    region = var.aws_region
}

And run packer fmt file.pkr.hcl resulting in:

data "amazon-ami" "amazon-linux-2" {
  filters = {
    name                = "amzn2-ami-hvm-2.*-x86_64-gp2"
    root-device-type    = "ebs"
    virtualization-type = "hvm"
  }
  most_recent = true
  owners      = ["amazon"]
  region      = var.aws_region
}

I tried to use runonsave extension but I have automatic saving of file every few seconds and when I am in the middle of writing a template it causes issues. It would be more convenient to pen a command pallet and execute this action through your plugin.
Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions