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

MODULES-3624 Allow setting indent character #237

Merged
merged 5 commits into from Sep 21, 2017
Merged

MODULES-3624 Allow setting indent character #237

merged 5 commits into from Sep 21, 2017

Conversation

jamesmcdonald
Copy link

@jamesmcdonald jamesmcdonald commented Jun 15, 2017

Add new params 'indent_char' and 'indent_width' which allow the character
used for indentation of newly-inserted values to be set instead of just using
a space, and for the width to be specified instead of computed. Some
software requires tabs in ini files, for example.

The default for 'indent_char' is ' ', and the default for 'indent_width' is undefined,
so the default behaviour is unchanged. Changing these params only affects
settings which are actually created. Settings which already exist and have a new value
will not be re-indented.

A limitation of this approach is that it will use whatever you specify
regardless of which characters the existing indentation uses. For example, if you
specify to use a tab and 2 spaces are detected, 2 tabs will be used for a new setting.
That's how it behaves now with spaces, it might just be less obvious when one is
specifying explicitly.

@tphoney
Copy link
Contributor

tphoney commented Sep 21, 2017

@jamesmcdonald hi, apologies you will need to rebase this PR. It looks great though. 👍

Add a new param 'indent' which allows the character used for indentation
of newly-inserted values to be set instead of just using a space. Some
software requires tabs in ini files, for example.

The default is ' ', so the default behaviour is unchanged. This change
only affects settings which are actually created. Settings which already
exist and have a new value will not be re-indented.

A limitation of this approach is that it will use whatever you specify
regardless of which characters the existing indentation uses. That's how
it behaves now with spaces, it might just be less obvious when one is
specifying explicitly.
@jamesmcdonald
Copy link
Author

There we go, rebased. I updated the conflicts to preserve other changes that had been commited in the mean time.

@tphoney
Copy link
Contributor

tphoney commented Sep 21, 2017

This is fantastic !

@tphoney tphoney merged commit 4d1c105 into puppetlabs:master Sep 21, 2017
cegeka-jenkins pushed a commit to cegeka/puppet-inifile that referenced this pull request Aug 5, 2021
* MODULES-3624 Allow setting indent character
Add a new param 'indent' which allows the character used for indentation
of newly-inserted values to be set instead of just using a space. Some
software requires tabs in ini files, for example.
The default is ' ', so the default behaviour is unchanged. This change
only affects settings which are actually created. Settings which already
exist and have a new value will not be re-indented.
A limitation of this approach is that it will use whatever you specify
regardless of which characters the existing indentation uses. That's how
it behaves now with spaces, it might just be less obvious when one is
specifying explicitly.
* Start adding support for specified indent char
* Allow setting of both indent_char and indent_width
* Update existing setting test to check indent_width does nothing
* Allow indent_width to be a string containing an integer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants