Skip to content

Releases: leaanthony/clir

v1.7.0

09 May 10:43
Compare
Choose a tag to compare

What's Changed

  • feat: Call a given function after calling the command (PostRun) by @GreyXor in #21
  • add slice flags by @zkep in #23
    Example:
StringsDefault []string `name:"strings_default" description:"The strings default" default:"one|two|three" sep:"|"

New Contributors

  • @zkep made their first contribution in #23

Full Changelog: v1.6.0...v1.7.0

v1.6.0

23 Jan 07:56
b80a127
Compare
Choose a tag to compare
  • Support positional arguments using the pos struct tag:
type PosPerson struct {
    Name  string `description:"The name of the person" pos:"1"`
    Admin bool   `description:"Is the person an admin" pos:"2"`
}

func TestCli_PositionalArgs(t *testing.T) {
    c := NewCli("test", "test positional args", "0")

    c.NewSubCommandFunction("create", "create a person", func(person *PosPerson) error {
        if person.Name != "bob" {
            t.Errorf("expected 'bob', got '%v'", person.Name)
        }
        if person.Admin != true {
            t.Errorf("expected true, got %v", person.Admin)
        }
        return nil
    })

    e := c.Run("create", "bob", "true")

    if e != nil {
        t.Errorf("unexpected error")
    }
}

v1.5.0

18 Jan 06:44
72b6cab
Compare
Choose a tag to compare

v1.4.0

19 Dec 02:02
faabf69
Compare
Choose a tag to compare
  • Support Int64, Uint, Uint64, Float64

v1.3.0

22 Nov 08:50
Compare
Choose a tag to compare
  • Support flags in embedded structs

v1.2.1

21 Nov 10:45
Compare
Choose a tag to compare
  • Fix crash in AddFlags if input has unexported fields

v1.2.0

29 Oct 01:15
Compare
Choose a tag to compare
  • New method to rapidly add sub commands: NewSubCommandFunction. Bind a function to a subcommand name and the function input gets automatically converted to CLI flags in the same way AddFlags works. The method is automatically called with the CLI flags. Specify default flags using an optional Default() method on your flags struct: https://clir.leaanthony.com/guide/subcommands/#adding-subcommands-with-functions

v1.1.0

27 Oct 09:34
Compare
Choose a tag to compare

v1.0.6

08 Sep 11:31
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v1.0.5...v1.0.6

v1.0.5

11 Oct 08:16
Compare
Choose a tag to compare