Skip to content
This repository was archived by the owner on Sep 1, 2025. It is now read-only.
This repository was archived by the owner on Sep 1, 2025. It is now read-only.

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

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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