Add NArg method to context structure

This commit is contained in:
Omer Murat Yildirim
2016-02-21 15:57:11 +02:00
parent 5db74198de
commit 802f64479d
3 changed files with 16 additions and 3 deletions

View File

@@ -197,6 +197,11 @@ func (c *Context) Args() Args {
return args
}
// Returns the number of the command line arguments.
func (c *Context) NArg() int {
return len(c.Args())
}
// Returns the nth argument, or else a blank string
func (a Args) Get(n int) string {
if len(a) > n {