Awesome Go

allot

CategoryText Processing
SubcategoryParsers/Encoders/Decoders
Stars0

Placeholder and wildcard text parsing for CLI tools and bots

About allot

allot MIT License GoDoc Go Report Card allot - Coverage Status Build Status

allot is a small Golang library to match and parse commands with pre-defined strings. For example use allot to define a list of commands your CLI application or Slackbot supports and check if incoming requests are matching your commands.

The allot library supports placeholders and regular expressions for parameter matching and parsing.

Usage

cmd := allot.NewCommand("revert <commits:integer> commits on <project:string> at (stage|prod)")
match, err := cmd.Match("revert 12 commits on example at prod")

if (err != nil)
  commits, _ = match.Integer("commits")
  project, _ = match.String("project")
  env, _ = match.Match(2)

  fmt.Printf("Revert \"%d\" on \"%s\" at \"%s\"", commits, project, env)
} else {
  fmt.Println("Request did not match command.")
}

Examples

See the hanu Slackbot framework for a usecase for allot:

Credits

Frequently Asked Questions

What is allot?

allot is a Text Processing library for the Go programming language. Placeholder and wildcard text parsing for CLI tools and bots

How do I install allot?

Install allot with the Go module system using `go get sbstjn/allot`. Check the repository for the current installation instructions.

What category does allot belong to?

allot is listed under Text Processing, specifically Parsers/Encoders/Decoders.

← Back to Parsers/Encoders/Decoders