From 0937464649e56ca302797a2d19866d5efda0bf9d Mon Sep 17 00:00:00 2001 From: Yagiz Degirmenci Date: Fri, 22 Jan 2021 01:41:02 +0300 Subject: [PATCH] feat: add -s --skip flag --- pkg/toc/toc.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/toc/toc.go b/pkg/toc/toc.go index 634ac08..26dcb68 100644 --- a/pkg/toc/toc.go +++ b/pkg/toc/toc.go @@ -69,7 +69,11 @@ func (t *toc) logic() { } func (t *toc) String() (s string) { - for _, v := range t.Content { + if t.Options.Skip >= len(t.Content) { + color.Red("ERROR: skip value is bigger than the length of table of contents") + os.Exit(1) + } + for _, v := range t.Content[t.Options.Skip:] { s += v }