Skip to content

Commit

Permalink
feat: add Depth to config
Browse files Browse the repository at this point in the history
  • Loading branch information
ycd committed Jan 21, 2021
1 parent c9181e4 commit a00c76a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions config/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Options:
-a, --append Append toc after <!--toc-->, or write to stdout.
-b, --bulleted Write as bulleted, or write as numbered list.
-s, --skip Skip the first given number of headers.
-d, --depth Set the number of maximum heading level to be included.
-h, --help Show this message and exit.
`

Expand All @@ -38,6 +39,7 @@ type Options struct {
Append bool `json:"append"`
Bulleted bool `json:"bulleted"`
Skip int `json:"skip"`
Depth int `json:"depth"`
ShowHelp bool `json:"show_help"`
}

Expand All @@ -54,6 +56,8 @@ func ConfigureOptions(fs *flag.FlagSet, args []string) (*Options, error) {
fs.BoolVar(&opts.Bulleted, "bulleted", true, "Write as bulleted, or write as numbered list")
fs.IntVar(&opts.Skip, "s", 0, "Skip the first given number of headers ")
fs.IntVar(&opts.Skip, "skip", 0, "Skip the first given number of headers ")
fs.IntVar(&opts.Depth, "d", 0, "Set the number of maximum heading level to be included")
fs.IntVar(&opts.Depth, "depth", 0, "Set the number of maximum heading level to be included")
fs.BoolVar(&opts.ShowHelp, "h", false, "Show help message")
fs.BoolVar(&opts.ShowHelp, "help", false, "Show help message")

Expand Down
1 change: 1 addition & 0 deletions pkg/toc/vars.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ type tocConfig struct {
Bulleted bool
Append bool
Skip int
Depth int
}

type toc struct {
Expand Down

0 comments on commit a00c76a

Please sign in to comment.