mirror of
https://github.com/go-ini/ini.git
synced 2026-06-19 21:46:45 +02:00
file: add DefaultFormat option around equal sign (#164)
Add option to have padding spaces around equal sign when PrettyFormat is disabled #161 eg: > ini.PrettyFormat = false > ini.DefaultFormatLeft = " " > ini.DefaultFormatRight = " "
This commit is contained in:
@@ -227,7 +227,8 @@ func (f *File) Append(source interface{}, others ...interface{}) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (f *File) writeToBuffer(indent string) (*bytes.Buffer, error) {
|
func (f *File) writeToBuffer(indent string) (*bytes.Buffer, error) {
|
||||||
equalSign := "="
|
equalSign := DefaultFormatLeft + "=" + DefaultFormatRight
|
||||||
|
|
||||||
if PrettyFormat || PrettyEqual {
|
if PrettyFormat || PrettyEqual {
|
||||||
equalSign = " = "
|
equalSign = " = "
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,6 +48,10 @@ var (
|
|||||||
// at package init time.
|
// at package init time.
|
||||||
LineBreak = "\n"
|
LineBreak = "\n"
|
||||||
|
|
||||||
|
// Place custom spaces when PrettyFormat and PrettyEqual are both disabled
|
||||||
|
DefaultFormatLeft = ""
|
||||||
|
DefaultFormatRight = ""
|
||||||
|
|
||||||
// Variable regexp pattern: %(variable)s
|
// Variable regexp pattern: %(variable)s
|
||||||
varPattern = regexp.MustCompile(`%\(([^\)]+)\)s`)
|
varPattern = regexp.MustCompile(`%\(([^\)]+)\)s`)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user