release: 0.2.2
- stop parsing options when pos args started - add sections with newline before
This commit is contained in:
parent
325c6c25d7
commit
0ea49ff1ad
2
Makefile
2
Makefile
@ -1,5 +1,5 @@
|
|||||||
NAME=multini
|
NAME=multini
|
||||||
VERSION=0.2.1
|
VERSION=0.2.2
|
||||||
GOCMD=go
|
GOCMD=go
|
||||||
LDFLAGS:="$(LDFLAGS) -X 'main.Version=$(VERSION)'"
|
LDFLAGS:="$(LDFLAGS) -X 'main.Version=$(VERSION)'"
|
||||||
GOBUILD=$(GOCMD) build -ldflags=$(LDFLAGS)
|
GOBUILD=$(GOCMD) build -ldflags=$(LDFLAGS)
|
||||||
|
2
args.go
2
args.go
@ -100,7 +100,7 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func parseArgs() error {
|
func parseArgs() error {
|
||||||
gnuflag.Parse(true)
|
gnuflag.Parse(false)
|
||||||
|
|
||||||
// info
|
// info
|
||||||
switch {
|
switch {
|
||||||
|
@ -17,4 +17,5 @@ DefKey3=NoSpaces!
|
|||||||
[SectionWithIndent]
|
[SectionWithIndent]
|
||||||
Key=Value
|
Key=Value
|
||||||
[SectionWithoutNewLineBefore]
|
[SectionWithoutNewLineBefore]
|
||||||
|
|
||||||
[NewSection]
|
[NewSection]
|
||||||
|
@ -89,6 +89,14 @@ func (obj *Ini) GetKeyVal(section, key, value string) error {
|
|||||||
func (obj *Ini) AddSection(section string) *Section {
|
func (obj *Ini) AddSection(section string) *Section {
|
||||||
sect, err := obj.FindSection(section)
|
sect, err := obj.FindSection(section)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
sectSize := len(obj.Sections)
|
||||||
|
if sectSize > 1 {
|
||||||
|
prevSect := obj.Sections[sectSize-1].(*Section)
|
||||||
|
lineSize := len(prevSect.Lines)
|
||||||
|
if lineSize == 0 || lineSize > 0 && prevSect.Lines[lineSize-1].Type() != TEmptyLine {
|
||||||
|
obj.Sections[sectSize-1].(*Section).Lines = append(obj.Sections[sectSize-1].(*Section).Lines, &EmptyLine{})
|
||||||
|
}
|
||||||
|
}
|
||||||
var newSection Section
|
var newSection Section
|
||||||
newSection.Name = section
|
newSection.Name = section
|
||||||
newSection.Prefix = obj.Sections[len(obj.Sections)-1].Indent()
|
newSection.Prefix = obj.Sections[len(obj.Sections)-1].Indent()
|
||||||
|
Loading…
Reference in New Issue
Block a user