Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
mkexp
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Package registry
Operate
Terraform modules
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
esmenv
mkexp
Commits
e83c631a
Commit
e83c631a
authored
1 year ago
by
Karl-Hermann Wieners
Browse files
Options
Downloads
Patches
Plain Diff
setconfig: fix whitespace by default, add opt-outs
parent
7266344c
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CHANGES.txt
+1
-0
1 addition, 0 deletions
CHANGES.txt
setconfig
+11
-9
11 additions, 9 deletions
setconfig
with
12 additions
and
9 deletions
CHANGES.txt
+
1
−
0
View file @
e83c631a
...
...
@@ -24,6 +24,7 @@ Tools
* setconfig: make output more similar to mkexp conventions
* remove quotes from section names (may be disabled)
* fix spaces before inline comments when no value is given
* fix spaces at end-of-line and before inline comments (may be disabled)
Release 1.3.1
=============
...
...
This diff is collapsed.
Click to expand it.
setconfig
+
11
−
9
View file @
e83c631a
...
...
@@ -37,11 +37,11 @@ command_line.add_argument('--header', '-H', action='append', default=[],
help
=
'
append text to header (initial comment)
'
)
command_line
.
add_argument
(
'
--add
'
,
'
-a
'
,
action
=
'
append
'
,
default
=
[],
help
=
'
add settings from file
'
)
command_line
.
add_argument
(
'
--inline-
comments
'
,
'
-c
'
,
action
=
'
store_true
'
,
help
=
'
compact white space
before inline comments
'
'
(BETA)
'
)
command_line
.
add_argument
(
'
--trailing-space
'
,
'
-t
'
,
action
=
'
store_true
'
,
help
=
'
remove white space at end of lines
'
)
command_line
.
add_argument
(
'
--
keep-
inline-
space
'
,
action
=
'
store_true
'
,
help
=
'
do not
compact white space
'
'
before inline comments
'
)
command_line
.
add_argument
(
'
--
keep-
trailing-space
'
,
action
=
'
store_true
'
,
help
=
'
do not
remove white space at end of lines
'
)
command_line
.
add_argument
(
'
--keep-section-quotes
'
,
action
=
'
store_true
'
,
help
=
'
do not remove quotes from section names
'
)
...
...
@@ -102,10 +102,12 @@ config_data.write(lines)
lines
.
seek
(
0
)
for
line
in
io
.
TextIOWrapper
(
lines
):
if
args
.
inline_comments
:
line
=
re
.
sub
(
r
'
= #
'
,
r
'
= #
'
,
line
)
if
args
.
inline_comments
:
line
=
re
.
sub
(
r
'
= (.*?) #
'
,
r
'
= \1 #
'
,
line
)
if
not
args
.
keep_section_quotes
:
line
=
re
.
sub
(
r
'
\[
"
(.*?)
"
\]
'
,
r
'
[\1]
'
,
line
)
if
args
.
trailing_space
:
if
not
args
.
keep_inline_space
:
line
=
re
.
sub
(
r
'
= #
'
,
r
'
= #
'
,
line
)
line
=
re
.
sub
(
r
'
= (.*?) #
'
,
r
'
= \1 #
'
,
line
)
if
not
args
.
keep_section_quotes
:
line
=
re
.
sub
(
r
'
\[
"
(.*?)
"
\]
'
,
r
'
[\1]
'
,
line
)
if
not
args
.
keep_trailing_space
:
print
(
line
.
rstrip
())
else
:
print
(
line
,
end
=
''
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment