HAProxy configuration parser

Overview

HAProxy

HAProxy configuration parser

autogenerated code

if you change types/types.go you need to run

go run generate/go-generate.go $(pwd)

Contributing

For commit messages and general style please follow the haproxy project's CONTRIBUTING guide and use that where applicable.

Please use golangci-lint run from github.com/golangci/golangci-lint for linting code.

Example

package main

import (
    "github.com/haproxytech/config-parser/v3"
    // ...
)
// ...

func main() {
    p := parser.Parser{}
    err := p.LoadData("/path/to/haproxy/file.cfg")
    log.Println(err)
    log.Println(p.String())

    {
        data, _ := p.Get(parser.Comments, parser.CommentsSectionName, "# _version", true)
        if err == errors.ErrFetch {
            log.Panicln("we have an fetch error !!")
        }
        ver, _ := data.(*types.Int64C)
        ver.Value = ver.Value + 1
    }

    {
        p.Set(parser.Frontends, "http", "option forwardfor", types.OptionForwardFor{})
    }

    {
        data, err := p.Get(parser.Global, parser.GlobalSectionName, "stats socket")
        if err != nil {
            log.Panicln(err)
        }
        val, _ := data.([]types.Socket)
        log.Println(val[0])
        val[0].Path = "$PWD/haproxy-runtime-api.1.sock"
        log.Println(val[0])
    }

    {
        data, err := p.Get(parser.Global, parser.GlobalSectionName, "daemon")
        log.Println(data, err)
        if err == errors.ErrFetch {
            log.Panicln("we have an fetch error !!")
        }
        //remove it
        p.Set(parser.Global, parser.GlobalSectionName, "daemon", nil)
    }

    {
        datar, err := p.Get(parser.Resolvers, "ns1", "nameserver")
        if err == nil {
            ns := datar.([]types.Nameserver)
            log.Println(ns[0].Name, ns[0].Address)
            log.Println(ns[1].Name, ns[1].Address)
            ns[1].Name = "hahaha"
            ns[0].Address = "0.0.0.0:8080"
        }
        datar, err = p.Get(parser.Resolvers, "ns1", "nameserver")
        if err == nil {
            ns := datar.([]types.Nameserver)
            log.Println(ns[0].Name, ns[0].Address)
            log.Println(ns[1].Name, ns[1].Address)
        }
    }

    {
        log.Println("nbproc ==================================================")
        data, err := p.Get(parser.Global, parser.GlobalSectionName, "nbproc")
        if err != nil {
            log.Println(err)
        } else {
            d := data.(*types.Int64C)
            log.Println(d.Value)
            d.Value = 5
        }
    }

    p.Save(configFilename)
}

License

Apache License 2.0

Comments
  • FEATURE/MEDIUM: add support for additional http-check directives introduced in HAProxy 2.2

    FEATURE/MEDIUM: add support for additional http-check directives introduced in HAProxy 2.2

    This is a re-open and re-implementation of #27

    It follows the HTTP Actions pattern to break out parsing implementations into "sub parsers". Because this replaces the prior existing implementation, it is a breaking change, and warrants a v3 release.

    See discussion in #27 .

    opened by anitgandhi 11
  • BUG/MINOR: Fix undefined renameio.WriteFile on Windows

    BUG/MINOR: Fix undefined renameio.WriteFile on Windows

    Signed-off-by: Norwin Schnyder [email protected]

    Using config-parser under Windows is not possible at the moment:

    # github.com/haproxytech/config-parser/v4
    \pkg\mod\github.com\haproxytech\config-parser\[email protected]\writer.go:73:9: undefined: renameio.WriteFile
    
    Compilation finished with exit code 2
    
    opened by snorwin 6
  • BUG/MINOR: Correctly hanlde IPv6 addresses when parsing <ip>:<port> pair

    BUG/MINOR: Correctly hanlde IPv6 addresses when parsing : pair

    Currently parser split : pair by the first colon which leads to incorrect result in case of IPv6, this pull request interprets the part after the last colon as a port and everything before as an address.

    Closes: #50

    opened by daa 4
  • Frontends defined with `listen` are not parsed correctly

    Frontends defined with `listen` are not parsed correctly

    Hello,

    We have a load of old haproxy 1.5 instances that we're trying to parse the configuration from in order to move them to a newer version (via internal orchestration), however they were all set up using the listen directive alone, for example:

    listen https-passthru-fe 172.21.126.151:443
    mode tcp
    acl hdrcheck hdr(Host) -i bar.com
    use_backend bar_backend
    default_backend foo_backend
    

    Rather than using the frontend directive with a bind, as would be expected today:

    frontend https-passthru-fe
    bind 172.21.126.151:443
    mode tcp
    acl hdrcheck hdr(Host) -i bar.com
    use_backend bar_backend
    default_backend foo_backend
    

    It appears the Listen section isn't configured with the same set of parsers as Frontend.

    Given this code:

    package main
    
    import (
    	"fmt"
    
    	parser "github.com/haproxytech/config-parser/v4"
    	"github.com/haproxytech/config-parser/v4/options"
    )
    
    func main() {
    	p, err := parser.New(options.Path("example.cfg"))
    	if err != nil {
    		panic(err)
    	}
    
    	frontends, err := p.SectionsGet(parser.Listen)
    	if err != nil {
    		panic(err)
    	}
    
    	fmt.Printf("Frontends: %+v\n", frontends)
    
    	frontendCount := 0
    	for _, frontend := range frontends {
    		frontendCount++
    
    		data, err := p.Get(parser.Listen, frontend, "acl")
    		if err != nil {
    			fmt.Printf("error getting frontend: %s, data: %+v\n", err, data)
                            continue
    		}
    
    		fmt.Printf("FE %s ACLs: %+v\n", frontend, data)
    	}
    }
    

    The first example will fail to parse the ACLs:

    Frontends: [stats 23173-172.21.126.151:443]
    error getting frontend ACLs: parser missing, data: <nil>
    

    Changing the section to parser.Frontend for both *Get()s, will result in the first example not being parsed at all (which I would assume is the correct behaviour), but the the second example returns the expected ACL data.

    FE https-passthru-fe  ACLs: [{Name:hdrcheck Criterion:hdr(host) Value:-i bar.com Comment:}]
    

    Does it make sense to add the same set of parsers to the Listen section as you have for the Frontend in order to support this type of configuration?

    opened by Xiol 3
  • How to set an htttp.Request to exist parser from read file?

    How to set an htttp.Request to exist parser from read file?

    Hi, I can't find the doc that describe how to use the config-parser. I guess something according to read the source code.

    So I have a question, how to set request.data to an exist parser that from read file? Because the data from Request struct is lowercase. ha

    opened by DeyunLuo 3
  • Observing errors in go get and go build

    Observing errors in go get and go build

    $ go clean; go build
    ..\..\..\..\..\..\github.com\haproxytech\client-native\configuration\acl.go:23:2: cannot find package "github.com/haproxytech/config-parser/v3" in any of:
            c:\go\src\github.com\haproxytech\config-parser\v3 (from $GOROOT)
            C:\Users\anupa\go\src\github.com\haproxytech\config-parser\v3 (from $GOPATH)
    ..\..\..\..\..\..\github.com\haproxytech\client-native\configuration\configuration.go:26:2: cannot find package "github.com/haproxytech/config-parser/v3/common" in any of:
            c:\go\src\github.com\haproxytech\config-parser\v3\common (from $GOROOT)
            C:\Users\anupa\go\src\github.com\haproxytech\config-parser\v3\common (from $GOPATH)
    ..\..\..\..\..\..\github.com\haproxytech\client-native\configuration\acl.go:24:2: cannot find package "github.com/haproxytech/config-parser/v3/errors" in any of:
            c:\go\src\github.com\haproxytech\config-parser\v3\errors (from $GOROOT)
            C:\Users\anupa\go\src\github.com\haproxytech\config-parser\v3\errors (from $GOPATH)
    ..\..\..\..\..\..\github.com\haproxytech\client-native\configuration\bind.go:27:2: cannot find package "github.com/haproxytech/config-parser/v3/params" in any of:
            c:\go\src\github.com\haproxytech\config-parser\v3\params (from $GOROOT)
            C:\Users\anupa\go\src\github.com\haproxytech\config-parser\v3\params (from $GOPATH)
    ..\..\..\..\..\..\github.com\haproxytech\client-native\configuration\configuration.go:29:2: cannot find package "github.com/haproxytech/config-parser/v3/parsers" in any of:
            c:\go\src\github.com\haproxytech\config-parser\v3\parsers (from $GOROOT)
            C:\Users\anupa\go\src\github.com\haproxytech\config-parser\v3\parsers (from $GOPATH)
    ..\..\..\..\..\..\github.com\haproxytech\client-native\configuration\filter.go:25:2: cannot find package "github.com/haproxytech/config-parser/v3/parsers/filters" in any of:
            c:\go\src\github.com\haproxytech\config-parser\v3\parsers\filters (from $GOROOT)
            C:\Users\anupa\go\src\github.com\haproxytech\config-parser\v3\parsers\filters (from $GOPATH)
    ..\..\..\..\..\..\github.com\haproxytech\client-native\configuration\http_request_rule.go:27:2: cannot find package "github.com/haproxytech/config-parser/v3/parsers/http/actions" in any of:
            c:\go\src\github.com\haproxytech\config-parser\v3\parsers\http\actions (from $GOROOT)
            C:\Users\anupa\go\src\github.com\haproxytech\config-parser\v3\parsers\http\actions (from $GOPATH)
    ..\..\..\..\..\..\github.com\haproxytech\client-native\configuration\configuration.go:30:2: cannot find package "github.com/haproxytech/config-parser/v3/parsers/stats/settings" in any of:
            c:\go\src\github.com\haproxytech\config-parser\v3\parsers\stats\settings (from $GOROOT)
            C:\Users\anupa\go\src\github.com\haproxytech\config-parser\v3\parsers\stats\settings (from $GOPATH)
    ..\..\..\..\..\..\github.com\haproxytech\client-native\configuration\tcp_request_rule.go:27:2: cannot find package "github.com/haproxytech/config-parser/v3/parsers/tcp/actions" in any of:
            c:\go\src\github.com\haproxytech\config-parser\v3\parsers\tcp\actions (from $GOROOT)
            C:\Users\anupa\go\src\github.com\haproxytech\config-parser\v3\parsers\tcp\actions (from $GOPATH)
    ..\..\..\..\..\..\github.com\haproxytech\client-native\configuration\tcp_request_rule.go:28:2: cannot find package "github.com/haproxytech/config-parser/v3/parsers/tcp/types" in any of:
            c:\go\src\github.com\haproxytech\config-parser\v3\parsers\tcp\types (from $GOROOT)
            C:\Users\anupa\go\src\github.com\haproxytech\config-parser\v3\parsers\tcp\types (from $GOPATH)
    ..\..\..\..\..\..\github.com\haproxytech\client-native\configuration\transaction.go:33:2: cannot find package "github.com/haproxytech/config-parser/v3/spoe" in any of:
            c:\go\src\github.com\haproxytech\config-parser\v3\spoe (from $GOROOT)
            C:\Users\anupa\go\src\github.com\haproxytech\config-parser\v3\spoe (from $GOPATH)
    ..\..\..\..\..\..\github.com\haproxytech\client-native\configuration\acl.go:25:2: cannot find package "github.com/haproxytech/config-parser/v3/types" in any of:
            c:\go\src\github.com\haproxytech\config-parser\v3\types (from $GOROOT)
            C:\Users\anupa\go\src\github.com\haproxytech\config-parser\v3\types (from $GOPATH)
    
    $ go get -v
    github.com/haproxytech/config-parser (download)
    package github.com/haproxytech/config-parser/v3: cannot find package "github.com/haproxytech/config-parser/v3" in any of:
            c:\go\src\github.com\haproxytech\config-parser\v3 (from $GOROOT)
            C:\Users\anupa\go\src\github.com\haproxytech\config-parser\v3 (from $GOPATH)
    package github.com/haproxytech/config-parser/v3/common: cannot find package "github.com/haproxytech/config-parser/v3/common" in any of:
            c:\go\src\github.com\haproxytech\config-parser\v3\common (from $GOROOT)
            C:\Users\anupa\go\src\github.com\haproxytech\config-parser\v3\common (from $GOPATH)
    package github.com/haproxytech/config-parser/v3/errors: cannot find package "github.com/haproxytech/config-parser/v3/errors" in any of:
            c:\go\src\github.com\haproxytech\config-parser\v3\errors (from $GOROOT)
            C:\Users\anupa\go\src\github.com\haproxytech\config-parser\v3\errors (from $GOPATH)
    package github.com/haproxytech/config-parser/v3/params: cannot find package "github.com/haproxytech/config-parser/v3/params" in any of:
            c:\go\src\github.com\haproxytech\config-parser\v3\params (from $GOROOT)
            C:\Users\anupa\go\src\github.com\haproxytech\config-parser\v3\params (from $GOPATH)
    package github.com/haproxytech/config-parser/v3/parsers: cannot find package "github.com/haproxytech/config-parser/v3/parsers" in any of:
            c:\go\src\github.com\haproxytech\config-parser\v3\parsers (from $GOROOT)
            C:\Users\anupa\go\src\github.com\haproxytech\config-parser\v3\parsers (from $GOPATH)
    package github.com/haproxytech/config-parser/v3/parsers/filters: cannot find package "github.com/haproxytech/config-parser/v3/parsers/filters" in any of:
            c:\go\src\github.com\haproxytech\config-parser\v3\parsers\filters (from $GOROOT)
            C:\Users\anupa\go\src\github.com\haproxytech\config-parser\v3\parsers\filters (from $GOPATH)
    package github.com/haproxytech/config-parser/v3/parsers/http/actions: cannot find package "github.com/haproxytech/config-parser/v3/parsers/http/actions" in any of:    
            c:\go\src\github.com\haproxytech\config-parser\v3\parsers\http\actions (from $GOROOT)
            C:\Users\anupa\go\src\github.com\haproxytech\config-parser\v3\parsers\http\actions (from $GOPATH)
    package github.com/haproxytech/config-parser/v3/parsers/stats/settings: cannot find package "github.com/haproxytech/config-parser/v3/parsers/stats/settings" in any of:
            c:\go\src\github.com\haproxytech\config-parser\v3\parsers\stats\settings (from $GOROOT)
            C:\Users\anupa\go\src\github.com\haproxytech\config-parser\v3\parsers\stats\settings (from $GOPATH)
    package github.com/haproxytech/config-parser/v3/parsers/tcp/actions: cannot find package "github.com/haproxytech/config-parser/v3/parsers/tcp/actions" in any of:      
            c:\go\src\github.com\haproxytech\config-parser\v3\parsers\tcp\actions (from $GOROOT)
            C:\Users\anupa\go\src\github.com\haproxytech\config-parser\v3\parsers\tcp\actions (from $GOPATH)
    package github.com/haproxytech/config-parser/v3/parsers/tcp/types: cannot find package "github.com/haproxytech/config-parser/v3/parsers/tcp/types" in any of:
            c:\go\src\github.com\haproxytech\config-parser\v3\parsers\tcp\types (from $GOROOT)
            C:\Users\anupa\go\src\github.com\haproxytech\config-parser\v3\parsers\tcp\types (from $GOPATH)
    package github.com/haproxytech/config-parser/v3/spoe: cannot find package "github.com/haproxytech/config-parser/v3/spoe" in any of:
            c:\go\src\github.com\haproxytech\config-parser\v3\spoe (from $GOROOT)
            C:\Users\anupa\go\src\github.com\haproxytech\config-parser\v3\spoe (from $GOPATH)
    package github.com/haproxytech/config-parser/v3/types: cannot find package "github.com/haproxytech/config-parser/v3/types" in any of:
            c:\go\src\github.com\haproxytech\config-parser\v3\types (from $GOROOT)
            C:\Users\anupa\go\src\github.com\haproxytech\config-parser\v3\types (from $GOPATH)
    
    
    opened by anupamasok 3
  • BUG/MINOR: fix error while parsing pgsql-check in defaults section

    BUG/MINOR: fix error while parsing pgsql-check in defaults section

    Hi, I am getting an error in dataplane api. Please refer #129 for details

    {"code":500,"message":"interface conversion: common.ParserData is *types.OptionPgsqlCheck, not *types.SimpleOption: /home/local/adarsh/go/pkg/mod/github.com/haproxytech/client-native/[email protected]/configuration/configuration.go:625 parseField"}

    opened by adarshprakash 3
  • Missing attributes not implemented

    Missing attributes not implemented

    I was trying to dynamically set the following attributes

    global

    • server-state-file
    • server-state-base
    • hard-stop-after
    • lua-load
    • ssl-dh-param-file
    • ssl-engine
    • ssl-mode-async
    • ssl-default-bind-ciphersuites
    • ssl-default-server-ciphersuites

    defaults

    • load-server-state-from-file
    • options
    • no option

    Tried as the following, YMMV

    var err error
    err = p.Set(parser.Global, parser.GlobalSectionName, "server-state-file", &types.StringC{Value: "state-global"})
    println(err)
    // attribute not found
    

    I'm getting the attribute not found error, even if I use the right parsers and section name according to each attribute.

    Any plan to implement these attributes?

    enhancement 
    opened by prometherion 3
  • feat(http-request): add use-service action

    feat(http-request): add use-service action

    Implement http-action:

    http-request use-service <service-name> [ { if | unless } <condition> ]
    

    as defined in https://www.haproxy.org/download/2.2/doc/configuration.txt

    Signed-off-by: Rémi Collignon [email protected]

    opened by miton18 3
  • Add JSON output

    Add JSON output

    This adds the ability to output JSON using .JSON() just as you would .String().

    I've tested this on a number of configs I found in the wild. It seems to export cleanly for everything I have found.

    Here's one example config I found online, and below is the JSON output from it:

    {
      "backend": {
        "static": {
          "balance": "roundrobin",
          "server": {
            "media1": "media1 check port 80",
            "media2": "media2 check port 80"
          }
        },
        "www": {
          "balance": "roundrobin",
          "server": {
            "load1": "localhost:8080 backup",
            "www1": "www1 check port 80",
            "www2": "www2 check port 80",
            "www3": "www3 check port 80"
          }
        }
      },
      "default": {
        "clitimeout": 50000,
        "contimeout": 5000,
        "log": "global",
        "maxconn": 2000,
        "mode": "http",
        "option": [
          "httplog",
          "redispatch",
          "dontlognull",
          "httpchk"
        ],
        "retries": 3,
        "srvtimeout": 50000
      },
      "frontend": {
        "http": {
          "acl": {
            "host_static": "hdr_beg(host) -i static",
            "url_static": "path_beg /static"
          },
          "bind": "0.0.0.0:80",
          "default_backend": "www",
          "option": "http-server-close",
          "use_backend": {
            "static": [
              "if host_static",
              "if url_static"
            ]
          }
        }
      },
      "global": {
        "daemon": true,
        "group": "haproxy",
        "maxconn": 4096,
        "user": "haproxy"
      },
      "listen": {
        "stats": {
          "bind": ":1936",
          "mode": "http",
          "stats": "enable"
        }
      }
    }
    
    opened by johnsusek 3
  • Parser doesn't parse last line correctly without a newline

    Parser doesn't parse last line correctly without a newline

    The parser ignores the final line of a configuration file if the line is not terminated by a newline.

    For example:

    backend 23173_https_144_147\n
    balance leastconn\n
    mode tcp\n
        timeout connect 50s\n
        timeout server 50s\n
    server https_144_147-8083 172.21.126.147:443 check check-ssl inter 3000 rise 2 fall 2 weight 1\n
    server https_144_147-8082 172.21.126.144:443 check check-ssl inter 3000 rise 2 fall 2 weight 1
    

    In the above snippet (with delimiters added for clarity), the final server line will be ignored by the parser when retrieving the servers.

    package main
    
    import (
    	"fmt"
    
    	parser "github.com/haproxytech/config-parser/v4"
    	"github.com/haproxytech/config-parser/v4/options"
    	"github.com/haproxytech/config-parser/v4/types"
    )
    
    func main() {
    	p, err := parser.New(options.Path("example.cfg"))
    	if err != nil {
    		panic(err)
    	}
    
    	backends, err := p.SectionsGet(parser.Backends)
    	if err != nil {
    		panic(err)
    	}
    
    	fmt.Printf("Backends: %+v\n", backends)
    
    	for _, backend := range backends {
    		data, _ := p.Get(parser.Backends, backend, "server")
    
    		servers, _ := data.([]types.Server)
    
    		backendAddrs := make([]string, 0, len(servers))
    		for i := range servers {
    			backendAddrs = append(backendAddrs, servers[i].Address)
    		}
    
    		fmt.Printf("BE Servers: %+v\n", backendAddrs)
    	}
    }
    
    Backends: [23173_https_144_147]
    BE Servers: [172.21.126.147:443]
    

    Adding a final terminating newline results in the correct parsing:

    Backends: [23173_https_144_147]
    BE Servers: [172.21.126.147:443 172.21.126.144:443]
    

    Thanks

    opened by Xiol 2
  • nil pointer dereference in endline comment with spaces

    nil pointer dereference in endline comment with spaces

    First of all thank you for your great work folks. :hugs:

    So I've created haproxy.org/backend-config-snippet and I added a acl line with comment like

    acl is_whitelisted src 1.2.3.4  # don't use on production
    

    and I got SIGSEV!

    I rolled back config and then tried to reproduce it and the is causing the panic in configParser.

    Here's the stacktrace:

    panic: runtime error: invalid memory address or nil pointer dereference
    [signal SIGSEGV: segmentation violation code=0x1 addr=0x58 pc=0xdbcaa4]
    
    goroutine 32 [running]:
    github.com/haproxytech/config-parser/v4.(*configParser).ProcessLine(_, {_, _}, {_, _, _}, {_, _}, {{}, {0x1b48ae1, ...}, ...})
    	/go/pkg/mod/github.com/haproxytech/config-parser/[email protected]/reader.go:155 +0xa24
    github.com/haproxytech/config-parser/v4.(*configParser).Process(0xc0000f2840, {0x1d7ee80, 0xc000948990})
    	/go/pkg/mod/github.com/haproxytech/config-parser/[email protected]/reader.go:90 +0x61a
    github.com/haproxytech/config-parser/v4.New({0xc000776040, 0x1, 0xc000d06420})
    	/go/pkg/mod/github.com/haproxytech/config-parser/[email protected]/parser.go:112 +0x1bd
    github.com/haproxytech/client-native/v3/configuration.(*client).AddParser(0xc00049bd40, {0xc000d06420, 0x24})
    	/go/pkg/mod/github.com/haproxytech/client-native/[email protected]/configuration/configuration.go:131 +0x25f
    github.com/haproxytech/client-native/v3/configuration.(*Transaction).startTransaction(0xc00049bd40, 0x3, 0x0)
    	/go/pkg/mod/github.com/haproxytech/client-native/[email protected]/configuration/transaction.go:128 +0x2d5
    github.com/haproxytech/client-native/v3/configuration.(*Transaction).StartTransaction(0x0, 0xc0017cd330)
    	/go/pkg/mod/github.com/haproxytech/client-native/[email protected]/configuration/transaction.go:99 +0x1b
    github.com/haproxytech/kubernetes-ingress/pkg/haproxy/api.(*clientNative).APIStartTransaction(0xc000450ba0)
    	/src/pkg/haproxy/api/api.go:128 +0x76
    github.com/haproxytech/kubernetes-ingress/pkg/controller.(*HAProxyController).clientAPIClosure(0xc000172f00, 0xc0017cd440)
    	/src/pkg/controller/controller.go:58 +0x49
    github.com/haproxytech/kubernetes-ingress/pkg/controller.(*HAProxyController).setToReady(0xc000172f00)
    	/src/pkg/controller/controller.go:177 +0x4f
    github.com/haproxytech/kubernetes-ingress/pkg/controller.(*HAProxyController).updateHAProxy(0xc000172f00)
    	/src/pkg/controller/controller.go:152 +0x505
    github.com/haproxytech/kubernetes-ingress/pkg/controller.(*HAProxyController).SyncData(0xc000172f00)
    	/src/pkg/controller/monitor.go:36 +0x457
    github.com/haproxytech/kubernetes-ingress/pkg/controller.(*HAProxyController).Start(0xc000172f00)
    	/src/pkg/controller/controller.go:81 +0x125
    created by main.main
    	/src/main.go:118 +0xac5
    

    that led me to https://github.com/haproxytech/config-parser/blob/7d0ec01198d41d7f767d57c608056ceb9401099d/reader.go#L155

    I know it was rude of me to use such char in a comment especialy in the endline comment, but nevertheless I created this issue.

    opened by dosmanak 0
  • no parser force-persist and option allbackups

    no parser force-persist and option allbackups

    opened by DeyunLuo 1
Owner
haproxytech
HAProxy Technologies
haproxytech
go command line option parser

go-flags: a go library for parsing command line arguments This library provides similar functionality to the builtin flag library of go, but provides

Jesse van den Kieboom 2.3k Jan 4, 2023
Fully featured Go (golang) command line option parser with built-in auto-completion support.

go-getoptions Go option parser inspired on the flexibility of Perl’s GetOpt::Long. Table of Contents Quick overview Examples Simple script Program wit

David Gamba 46 Dec 14, 2022
CONTRIBUTIONS ONLY: A Go (golang) command line and flag parser

CONTRIBUTIONS ONLY What does this mean? I do not have time to fix issues myself. The only way fixes or new features will be added is by people submitt

Alec Thomas 3.3k Dec 29, 2022
Kong is a command-line parser for Go

Kong is a command-line parser for Go Introduction Help Help as a user of a Kong application Defining help in Kong Command handling Switch on the comma

Alec Thomas 1.2k Dec 27, 2022
Brigodier is a command parser & dispatcher, designed and developed for command lines such as for Discord bots or Minecraft chat commands. It is a complete port from Mojang's "brigadier" into Go.

brigodier Brigodier is a command parser & dispatcher, designed and developed to provide a simple and flexible command framework. It can be used in man

Minekube 16 Dec 15, 2022
A simple command line time description parser

Zeit Zeit is an extremely simple command line application to read a natural language time description and output it as a timestamp. The main usecase f

ElKowar 6 Aug 21, 2021
APFS parser written in pure Go

[WIP] go-apfs ?? APFS parser written in pure Go Originally from this ipsw branch Install go get github.com/blacktop/go-apfs apfs cli Install go instal

null 41 Dec 24, 2022
A golang tag key value parser

tag_parser A golang tag key value parser Installation go get github.com/gvassili/tag_parser Example package main import ( "fmt" "github.com/gvass

Gwenael 0 Nov 24, 2021
A Protobuf parser

A Protobuf parser for Go This package contains a cleanroom Protobuf parser for Go using Participle. This was originally an example within Participle.

Alec Thomas 13 Nov 9, 2022
Config File Parser

Config File Parser Speed It was Implemented by binary tree and only suitable for small project. Ignore Any line starting with specific prefix will be

AoXiang Li 1 May 20, 2022
YANG parser and compiler to produce Go language objects

Current support for goyang is for the latest 3 Go releases. goyang YANG parser and compiler for Go programs. The yang package (pkg/yang) is used to co

OpenConfig 203 Dec 12, 2022
Golisp-wtf - A lisp interpreter (still just a parser) implementation in golang. You may yell "What the fuck!?.." when you see the shitty code.

R6RS Scheme Lisp dialect interpreter This is an implementation of a subset of R6RS Scheme Lisp dialect in golang. The work is still in progress. At th

Vladimir Novikov 0 Jan 7, 2022
Ghissue - This repo contains a github issue parser, that is useful for Enterprise Github accounts.

Ghissue - This repo contains a github issue parser, that is useful for Enterprise Github accounts. Sometimes is needed to parse the content of the issue for some data extraction or statistics purposes.

niloofargheibi 1 Feb 6, 2022
News-parser-cli - Simple CLI which allows you to receive news depending on the parameters passed to it

news-parser-cli Simple CLI which allows you to receive news depending on the par

Maxym 0 Jan 4, 2022
Golang parser for Intuit Interchange Format (.IIF) files

Intuit Interchange Format (.IIF) Parser Install go get github.com/joshuaslate/iif Usage iiifile, err := os.Open("./transactions.iif") if err != nil {

Josh Slate 0 Jan 15, 2022
minigli is a tiny command argument parser for Go.

minigli is a tiny command argument parser for Go.

hitoshi44 0 Jan 29, 2022
Golang library with POSIX-compliant command-line UI (CLI) and Hierarchical-configuration. Better substitute for stdlib flag.

cmdr cmdr is a POSIX-compliant, command-line UI (CLI) library in Golang. It is a getopt-like parser of command-line options, be compatible with the ge

hz 116 Oct 28, 2022
Tag-based environment configuration for structs

env Tag-based environment configuration for structs. Installation $ go get -u github.com/codingconcepts/env Usage package main import ( "fmt" "log"

Coding Concepts 102 Dec 23, 2022
Reads from existing Cloud Providers (reverse Terraform) and generates your infrastructure as code on Terraform configuration

TerraCognita Imports your current Cloud infrastructure to an Infrastructure As Code Terraform configuration (HCL) or/and to a Terraform State. At Cycl

Cycloid 1.4k Dec 30, 2022