| 1 | package iniscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/ini`/ |
| 2 | |
| 3 | import ( |
| 4 | "fmtscip-go gomod github.com/golang/go/src go1.25 fmt/" |
| 5 | "github.com/tomwright/dasel/v3/modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/" |
| 6 | "github.com/tomwright/dasel/v3/parsingscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/" |
| 7 | "gopkg.in/ini.v1scip-go gomod gopkg.in/ini.v1 v1.67.0 `gopkg.in/ini.v1`/" |
| 8 | ) |
| 9 | |
| 10 | var _ parsingscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/.Readerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Reader# = (*iniReaderscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/ini`/iniReader#)(nil) |
| 11 | |
| 12 | func initscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/ini`/init().() { |
| 13 | parsingscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/.RegisterReaderscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/RegisterReader().(INIscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/ini`/INI., newINIReaderscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/ini`/newINIReader().) |
| 14 | parsingscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/.RegisterWriterscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/RegisterWriter().(INIscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/ini`/INI., newINIWriterscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/ini`/newINIWriter().) |
| 15 | } |
| 16 | |
| 17 | func newINIReaderscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/ini`/newINIReader().(options parsingscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/.ReaderOptionsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/ReaderOptions#) (parsingscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/.Readerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Reader#, error) { |
| 18 | return &iniReaderscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/ini`/iniReader#{}, nil |
| 19 | } |
| 20 | |
| 21 | type iniReaderscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/ini`/iniReader# struct{} |
| 22 | |
| 23 | // Read reads a value from a byte slice. |
| 24 | func (j *iniReaderscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/ini`/iniReader#) Readscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/ini`/iniReader#Read().(data []byte) (*modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#, error) { |
| 25 | f, err := iniscip-go gomod gopkg.in/ini.v1 v1.67.0 `gopkg.in/ini.v1`/.LoadSourcesscip-go gomod gopkg.in/ini.v1 v1.67.0 `gopkg.in/ini.v1`/LoadSources().(iniscip-go gomod gopkg.in/ini.v1 v1.67.0 `gopkg.in/ini.v1`/.LoadOptionsscip-go gomod gopkg.in/ini.v1 v1.67.0 `gopkg.in/ini.v1`/LoadOptions#{}, data) |
| 26 | if err != nil { |
| 27 | return nil, fmtscip-go gomod github.com/golang/go/src go1.25 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25 fmt/Errorf().("failed to parse ini: %w", err) |
| 28 | } |
| 29 | |
| 30 | res, err := j.readSectionscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/ini`/iniReader#readSection().(f.Sectionscip-go gomod gopkg.in/ini.v1 v1.67.0 `gopkg.in/ini.v1`/File#Section().(iniscip-go gomod gopkg.in/ini.v1 v1.67.0 `gopkg.in/ini.v1`/.DefaultSectionscip-go gomod gopkg.in/ini.v1 v1.67.0 `gopkg.in/ini.v1`/DefaultSection.)) |
| 31 | if err != nil { |
| 32 | return nil, err |
| 33 | } |
| 34 | |
| 35 | for _, s := range f.Sectionsscip-go gomod gopkg.in/ini.v1 v1.67.0 `gopkg.in/ini.v1`/File#Sections().() { |
| 36 | if s.Namescip-go gomod gopkg.in/ini.v1 v1.67.0 `gopkg.in/ini.v1`/Section#Name().() == iniscip-go gomod gopkg.in/ini.v1 v1.67.0 `gopkg.in/ini.v1`/.DefaultSectionscip-go gomod gopkg.in/ini.v1 v1.67.0 `gopkg.in/ini.v1`/DefaultSection. { |
| 37 | continue |
| 38 | } |
| 39 | sectionValue, err := j.readSectionscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/ini`/iniReader#readSection().(s) |
| 40 | if err != nil { |
| 41 | return nil, err |
| 42 | } |
| 43 | if err := res.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().(s.Namescip-go gomod gopkg.in/ini.v1 v1.67.0 `gopkg.in/ini.v1`/Section#Name().(), sectionValue); err != nil { |
| 44 | return nil, err |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | return res, nil |
| 49 | } |
| 50 | |
| 51 | func (j *iniReaderscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/ini`/iniReader#) readSectionscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/ini`/iniReader#readSection().(s *iniscip-go gomod gopkg.in/ini.v1 v1.67.0 `gopkg.in/ini.v1`/.Sectionscip-go gomod gopkg.in/ini.v1 v1.67.0 `gopkg.in/ini.v1`/Section#) (*modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#, error) { |
| 52 | res := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewMapValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewMapValue().() |
| 53 | for _, k := range s.Keysscip-go gomod gopkg.in/ini.v1 v1.67.0 `gopkg.in/ini.v1`/Section#Keys().() { |
| 54 | keyName := k.Namescip-go gomod gopkg.in/ini.v1 v1.67.0 `gopkg.in/ini.v1`/Key#Name().() |
| 55 | keyValue := k.Valuescip-go gomod gopkg.in/ini.v1 v1.67.0 `gopkg.in/ini.v1`/Key#Value().() |
| 56 | |
| 57 | if err := res.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().(keyName, modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewStringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewStringValue().(keyValue)); err != nil { |
| 58 | return nil, err |
| 59 | } |
| 60 | } |
| 61 | for _, s := range s.ChildSectionsscip-go gomod gopkg.in/ini.v1 v1.67.0 `gopkg.in/ini.v1`/Section#ChildSections().() { |
| 62 | childSection, err := j.readSectionscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/ini`/iniReader#readSection().(s) |
| 63 | if err != nil { |
| 64 | return nil, err |
| 65 | } |
| 66 | if err := res.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().(s.Namescip-go gomod gopkg.in/ini.v1 v1.67.0 `gopkg.in/ini.v1`/Section#Name().(), childSection); err != nil { |
| 67 | return nil, err |
| 68 | } |
| 69 | } |
| 70 | return res, nil |
| 71 | } |