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

第一个小目标,完成一个最简单的解析器 #2

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

第一个小目标,完成一个最简单的解析器 #2

guonaihong opened this issue Jan 26, 2020 · 0 comments

Comments

@guonaihong
Copy link
Owner

guonaihong commented Jan 26, 2020

完成最基本的解析器

package main

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

func main() {

     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" `
    }   
    c := cat{}
    clop.Bind(&c)
}
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