Request for yamlfmt classic confinment


We would like to make yamlfmt 1.1 have a classic confinement

yamlfmt is a simple yaml formatter, which reads a files and formats it.

For example:

- "name": "etcd"
  - "alert": "EtcdInsufficientMembers"
      "message": "Etcd cluster \"{{ $labels.job }}\": insufficient members ({{ $value }})."
    "expr": |
      count(up{job="etcd"} == 0) by (job) > (count(up{job="etcd"}) by (job) / 2 - 1)
    "for": "3m"
      "severity": "critical"

After executing yamlfmt it becomes:

- name: etcd
  - alert: EtcdInsufficientMembers
      message: 'Etcd cluster "{{ $labels.job }}": insufficient members ({{ $value
    expr: |
      count(up{job="etcd"} == 0) by (job) > (count(up{job="etcd"}) by (job) / 2 - 1)
    for: 3m
      severity: critical

Source code is available in:

Previously we had plugs: ["home", "desktop"], but that is not enough if a file is outside the home or desktop directory.

Is there any way we can achieve this without classic confinement?

Here is the link to failed review

Thank you for taking a look!

Best Regards

I’d prefer if this sort of tool used home and removable-media (I don’t see why it would need desktop); if the file you’re wanting to format is not in home (or removable-media) it’s not unreasonable to tell the user to do the file replacing themselves.

Is it really that common to want to format a file not in your home?

Keep in mind that making it classic would mean that you can’t use the snap on a core device.

1 Like

Thanks for the info. I needed that for removable-media stuff, didn’t know that plug exists. Thanks!

You can close this.