Skip to content

Commit

Permalink
Merge branch 'master' of github.com:jwaldrip/odin
Browse files Browse the repository at this point in the history
  • Loading branch information
jwaldrip committed Nov 5, 2014
2 parents 6e2bf06 + 3444aa0 commit 14ee0da
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,42 @@ the user is: jason
the action is: hello
```

### Output

#### Helpers
Output is possible directly on the CLI and is prefered over using fmt. Available commands map to their fmt counterparts.

method | description
--- | ---
`ErrPrint(a ...interface{})` | Prints to the err output.
`ErrPrintf(format string, a ...interface{})` | Prints formatted to the err output.
`ErrPrintln(a ...interface{})` | Prints a line to the err output.
`Print(a ...interface{})` | Prints to the std output.
`Printf(format string, a ...interface{})` | Prints formatted to the std output.
`Println(a ...interface{})` | Prints a line to the std output.

```go
package main

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

app := cli.New("1.0.0", "my app", func(c cli.Command){
c.Println("hello world")
c.ErrPrintln("There was an error")
}
```

#### Custom Output
Any `io.Writer` can be used as an output

```go
outbuffer := bytes.NewBufferString("")
errbuffer := bytes.NewBufferString("")
app.SetStdOut(outbuffer)
app.SetStdErr(errbuffer)
```


### Self Documentation

#### Usage
Expand Down
2 changes: 1 addition & 1 deletion version.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package main

var version = "v1.6.2"
var version = "v1.7.0"

0 comments on commit 14ee0da

Please sign in to comment.