fix cnf/parser/bash to restore ANY-typed lines + restore comments at the end of assignment lines properly
This commit is contained in:
parent
bca2b145bc
commit
3331970eb5
|
@ -61,6 +61,8 @@ func (d *Decoder) Decode(v interface{}) error {
|
||||||
if match != nil {
|
if match != nil {
|
||||||
l.Type = ASSIGNMENT
|
l.Type = ASSIGNMENT
|
||||||
l.Components = match[1:]
|
l.Components = match[1:]
|
||||||
|
} else {
|
||||||
|
l.Components = []string{line}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4. add to file
|
// 4. add to file
|
||||||
|
|
|
@ -38,7 +38,7 @@ func (e *Encoder) Encode(v interface{}) error {
|
||||||
|
|
||||||
// optional comment
|
// optional comment
|
||||||
if len(line.Components[3]) > 0 {
|
if len(line.Components[3]) > 0 {
|
||||||
repr += fmt.Sprintf(" #%s", line.Components[3])
|
repr += fmt.Sprintf(" %s", line.Components[3])
|
||||||
}
|
}
|
||||||
|
|
||||||
// ANY
|
// ANY
|
||||||
|
|
Loading…
Reference in New Issue