diff --git a/main.go b/main.go index 2edd8b3..bc1170a 100644 --- a/main.go +++ b/main.go @@ -34,6 +34,7 @@ func main() { reverseOption := flag.Bool("reverse", false, "Reverse string in line") uniqOption := flag.Bool("uniq", false, "Remove duplicated line") injectOption := flag.String("inject", "", "Inject stdin into the format of the factor value (This is %%INJECT%% line!)") + withLCOption := flag.Bool("with-lc", false, "With letters count (colorize magenta)") // Custom usage flag.Usage = func() { @@ -64,26 +65,27 @@ func main() { // Set Options options := model.Options{ - Files: files, - Append: *appendOption, - ChunkedLine: *chunkedLineOption, - WithLine: *withLineOption, - WithTimestamp: *withTimeOption, - Prefix: *prefixOption, - Suffix: *suffixOption, - RemoveNewLine: *rmnlOption, - Distribute: *distributeOption, - Regex: *regexOption, - RegexV: *regexvOption, - Replace: *replaceOption, - Find: *findOption, - Color: !*colorOption, - Split: *splitOption, - Format: *formatOption, - Debug: *debugOption, - Reverse: *reverseOption, - Uniq: *uniqOption, - Inject: *injectOption, + Files: files, + Append: *appendOption, + ChunkedLine: *chunkedLineOption, + WithLine: *withLineOption, + WithTimestamp: *withTimeOption, + Prefix: *prefixOption, + Suffix: *suffixOption, + RemoveNewLine: *rmnlOption, + Distribute: *distributeOption, + Regex: *regexOption, + RegexV: *regexvOption, + Replace: *replaceOption, + Find: *findOption, + Color: !*colorOption, + Split: *splitOption, + Format: *formatOption, + Debug: *debugOption, + Reverse: *reverseOption, + Uniq: *uniqOption, + Inject: *injectOption, + WithLettersCount: *withLCOption, } if *debugOption { printing.DebugMsg("MSG", "Running on Debug mode", options.Debug) diff --git a/pkg/gee/string.go b/pkg/gee/string.go index a7f32ba..e5a0d60 100644 --- a/pkg/gee/string.go +++ b/pkg/gee/string.go @@ -46,6 +46,11 @@ func StringProc(l string, stdLine int, options model.Options) (string, string) { resultPlain = "[" + GetNowTime() + "] " + resultPlain } + if options.WithLettersCount { + result = au.BrightMagenta("["+strconv.Itoa(len(l))+"] ").String() + result + resultPlain = "[" + strconv.Itoa(len(l)) + "] " + resultPlain + } + if options.Split != "" { resultArr = strings.Split(result, options.Split) resultPlainArr = strings.Split(resultPlain, options.Split) diff --git a/pkg/model/options.go b/pkg/model/options.go index bb3e3c4..2a20f09 100644 --- a/pkg/model/options.go +++ b/pkg/model/options.go @@ -2,25 +2,26 @@ package model // Options is struct of gee options type Options struct { - Files []string - Append bool - ChunkedLine int - ChunkedSize string - Prefix string - Suffix string - WithTimestamp bool - WithLine bool - RemoveNewLine bool - Format string - Regex string - RegexV string - Split string - Distribute bool - Replace string - Find string - Color bool - Debug bool - Reverse bool - Uniq bool - Inject string + Files []string + Append bool + ChunkedLine int + ChunkedSize string + Prefix string + Suffix string + WithTimestamp bool + WithLine bool + RemoveNewLine bool + Format string + Regex string + RegexV string + Split string + Distribute bool + Replace string + Find string + Color bool + Debug bool + Reverse bool + Uniq bool + Inject string + WithLettersCount bool }