Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

实现args功能 #3

Closed
guonaihong opened this issue Jan 29, 2020 · 0 comments
Closed

实现args功能 #3

guonaihong opened this issue Jan 29, 2020 · 0 comments

Comments

@guonaihong
Copy link
Owner

guonaihong commented Jan 29, 2020

在shell里面,没有被当成命令行选项的参数,一般另有用途,clop提供args tag,用于保存下面的r.go pool.c会存放至cat.Args变量里。

cat -n r.go -T pool.c

clop用法

 type cat struct {
        NumberNonblank bool `clop:"-b;--number-nonblank"
                            usage:"number nonempty output lines, overrides"`

        ShowEnds bool `clop:"-E;--show-ends"
                            usage:"display $ at end of each line"`

        Number bool `clop:"-n;--number"
                            usage:"number all output lines"`

        SqueezeBlank bool `clop:"-s;--squeeze-blank"
                            usage:"suppress repeated empty output lines"`

        ShowTab bool `clop:"-T;--show-tabs"
                            usage:"display TAB characters as ^I"`

        ShowNonprinting bool `clop:"-v;--show-nonprinting"
                            usage:"use ^ and M- notation, except for LFD and TAB" `

        Args []string `clop:"args"`
    }   

c := cat{}
clop.Bind(&c)
guonaihong added a commit that referenced this issue Jan 29, 2020
This was referenced Jan 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant