Skip to content

v1.0.1

Latest

Choose a tag to compare

@mirkobrombin mirkobrombin released this 19 May 08:51

Changelog

Renamed the main package name from flagsbinder to just binder.

Features

  • Auto‑Discovery: Read struct fields tagged with flag:"name,type[,choices]" and bind accordingly.

  • Default Handlers: Built‑in support for:

    • boolstrconv.ParseBool
    • intstrconv.ParseInt
    • durationtime.ParseDuration
    • enum → string validation against allowed choices
    • strings → split colon‑separated values into []string
  • Custom Handlers: Override any binding with AddBool, AddInt, AddDuration, AddEnum, or AddStrings.

  • Hooks: Register BeforeHook and AfterHook callbacks around each binding operation.

  • Batch Binding: Apply multiple key→args pairs at once with RunAll.

  • Optional Backup: Write a JSON snapshot of your struct on NewBinder(..., autobackup=true).

Resources