Skip to content

Version 1.5.0

Compare
Choose a tag to compare
@jwaldrip jwaldrip released this 23 Oct 20:00
· 61 commits to master since this release

Features

  • Odin now supports flags before or after the parameters for the given command.

_example:_

$ go run main.go hello --loudly
HELLO
$ go run main.go --loudly hello
HELLO

_main.go:_

package main

import (
    "fmt"
    "strings"

    "github.com/jwaldrip/odin/cli"
)

var app = cli.New("0.0.1", "say a word", func(c cli.Command) {
    str := c.Param("word").String()
    if c.Flag("loudly").Get() == true {
        str = strings.ToUpper(str)
    }
    fmt.Println(str)
})

func init() {
    app.DefineParams("word")
    app.DefineBoolFlag("loudly", false, "say it loudly")
}

func main() {
    app.Start()
}

View the PR: #13

Special thanks to @dcarley for this request!!