Skip to content

Should be possible to enumerate the parsed attributes in a given Section #57

Open
@csabatuz-chess

Description

@csabatuz-chess

Assuming

import (
  parser "github.com/haproxytech/config-parser/v5"
)
...
  p := parser.New(content, options)

Proposal
It would be a useful feature, to be able to list all the set attributes in a given section
E.g.

attributes, err := p.AttributesGet(parser.Global, parser.GlobalSectionName) // ([]string, error)

This would allow a piece of code to iterate over the existing attributes.
Currently it's not even possible to list the registered attributes for a given section type, so if some code wanted to enumerate all the attributes e.g. in a loop, it'd need to maintain a list of attributes, while this information is readily available for the parser (both the possible (via ConfiguredParsers), and the actually set attributes (via Parsers))

(Happily) wiling to contribute code if this feature makes sense.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions