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

preserve spacing between template and instance #48

Open
thomasdfischer opened this issue Sep 3, 2018 · 5 comments
Open

preserve spacing between template and instance #48

thomasdfischer opened this issue Sep 3, 2018 · 5 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@thomasdfischer
Copy link
Member

Example

Template:

{
    "protocol": "http://",
    "host_sans_protocol": "localhost",
    "port": 5000,

    "bundle_protocol": "http://",
    "bundle_host_sans_protocol": "localhost",
    "bundle_port": 2999
}

Mark that as a template. Then, run cfg new entry-addr entry-addr-local.json. You'll see the output does not preserve spacing. Also, the fields are sorted alphabetically.

{
    "bundle_host_sans_protocol": "",
    "bundle_port": 0,
    "bundle_protocol": "",
    "host_sans_protocol": "",
    "port": 0,
    "protocol": ""
}
@thomasdfischer
Copy link
Member Author

This is a difficult problem to solve in an elegant way.

@thomasdfischer thomasdfischer added enhancement New feature or request help wanted Extra attention is needed labels Sep 3, 2018
@Joshuad2uiuc
Copy link

Is there a reason that you also change the ordering of it to be alphabetical instead of preserving order? Is it a config file style guideline?

@narendasan
Copy link

Is there a reason why you'd want to support this? As long as the output format is nice it shouldn't matter to the user, could functionally be a beautifier for a lot of dirty settings. Comments may be useful to preserve though

@Joshuad2uiuc
Copy link

I feel like theres use cases of config files where you have your config file setup so that things are ordered in a certain way so its easier to read or for grouping.

@narendasan
Copy link

Perhaps adding support for something like namespaces can help preserve groupings without modifying the config itself

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants