Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional format options #107

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

fuale
Copy link

@fuale fuale commented Nov 11, 2022

Proposed changes

I was looking for a program that can format “nginx” files, but the ones I found either didn't work or didn't have sufficient options.

Here I add --align, --spacious and --write options for a “format” action. These options will make “format” action more usable

  • --align will align all the directives within a block.
  • --spacious will add spaces after blocks.
  • --write will write formatted config file in-place.

Without options:

server {
    listen 443 ssl;
    ssl_certificate fullchain.pem;
    ssl_certificate_key privite.pem;
    server_name _;
    index index.html;
    root /public;
    charset utf-8;
    expires $expires;
    location ~ \d {
        image_filter_buffer 5M;
        image_filter_interlace on;
        image_filter_jpeg_quality 75;
    }
    location ~ \d {
        image_filter_buffer 5M;
        image_filter_interlace on;
        image_filter_jpeg_quality 75;
    }
}

with options being set:

server {
    listen              443 ssl;
    ssl_certificate     fullchain.pem;
    ssl_certificate_key privite.pem;
    server_name         _;
    index               index.html;
    root                /public;
    charset             utf-8;
    expires             $expires;
    location ~ \d {
        image_filter_buffer       5M;
        image_filter_interlace    on;
        image_filter_jpeg_quality 75;
    }

    location ~ \d {
        image_filter_buffer       5M;
        image_filter_interlace    on;
        image_filter_jpeg_quality 75;
    }
}

Checklist

Before creating a PR, run through this checklist and mark each as complete.

  • I have read the CONTRIBUTING doc
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked that all unit tests pass after adding my changes
  • I have updated necessary documentation
  • I have rebased my branch onto master
  • I will ensure my PR is targeting the master branch and pulling from my branch from my own fork

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant