func convert(filename string, w io.Writer, lexer, theme, format string) error { f, err := os.Open(filename) if err != nil { return err } defer f.Close() if lexer == "" { lexer = filename } return beni.Highlight(f, w, lexer, theme, format) }
func convertStdIn(o CLOptions) { lexer := o.Lexer theme := o.Theme format := o.Formatter if lexer == "" { lexer = "Go" } if theme == "" { theme = "base16" } if format == "" { format = "Terminal256" } stdin := bufio.NewReader(os.Stdin) stdout := bufio.NewWriter(os.Stdout) defer stdout.Flush() beni.Highlight(stdin, stdout, lexer, theme, format) return }