Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
guonaihong authored Apr 21, 2020
1 parent b96744c commit b9bcf4f
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ clop 是一款基于struct的命令行解析器,麻雀虽小,五脏俱全。
- [3. Set default value](#set-default-value)
- [4. How to implement git style commands](#subcommand)
- [5. Get command priority](#get-command-priority)
- [6. Can only be set once](#can-only-be-set-once)
- [Implementing linux command options](#Implementing-linux-command-options)
- [cat](#cat)
## Installation
Expand Down Expand Up @@ -207,6 +208,30 @@ func main() {
// cat -Eb
// 输出 cat -E -b
```


## Can only be set once
```go
package main

import (
"github.com/guonaihong/clop"
)

type Once struct {
Debug bool `clop:"-d; --debug; once" usage:"debug mode"`
}

func main() {
o := Once{}
clop.Bind(&o)
}
/*
./once -debug -debug
error: The argument '-d' was provided more than once, but cannot be used multiple times
For more information try --help
*/
```
## Implementing linux command options
### cat
```go
Expand Down

0 comments on commit b9bcf4f

Please sign in to comment.