clx-browser

[ACTIVE] a smol browser based off of circumflex
git clone git://git.figbert.com/clx-browser.git
Log | Files | Refs | README | LICENSE

commit 22facc4e3b8457a3b26b2811c4bfb0ed7e539afc
parent 01994d7a0af04f83cef32b86a2d2d2d525200ea0
Author: FIGBERT <figbert@figbert.com>
Date:   Thu, 28 Jul 2022 17:52:13 -0700

Merge CLI package into main.go

Diffstat:
Dcli/cli.go | 28----------------------------
Mmain.go | 20++++++++++++++++++--
2 files changed, 18 insertions(+), 30 deletions(-)

diff --git a/cli/cli.go b/cli/cli.go @@ -1,28 +0,0 @@ -package cli - -import ( - "os" - "os/exec" - "strings" - - "git.figbert.com/clx-browser/constants/unicode" -) - -func Less(input string) { - command := exec.Command("less", - "--RAW-CONTROL-CHARS", - "--pattern="+unicode.ZeroWidthSpace, - "--ignore-case", - "--tilde", - "--use-color", - "-P?e"+"\u001B[48;5;237m "+"\u001B[38;5;200m"+"e"+"\u001B[38;5;214m"+"n"+"\u001B[38;5;69m"+"d "+"\033[0m", - "-DSy", - "-DP-") - - command.Stdin = strings.NewReader(input) - command.Stdout = os.Stdout - - if err := command.Run(); err != nil { - panic(err) - } -} diff --git a/main.go b/main.go @@ -2,8 +2,10 @@ package main import ( "os" + "os/exec" + "strings" - "git.figbert.com/clx-browser/cli" + "git.figbert.com/clx-browser/constants/unicode" "git.figbert.com/clx-browser/markdown/parser" "git.figbert.com/clx-browser/markdown/postprocessor" "git.figbert.com/clx-browser/markdown/renderer" @@ -23,5 +25,19 @@ func main() { renderedArticle := renderer.ToString(blocks, 70, " ▎") renderedArticle = postprocessor.Process(header+renderedArticle, url) - cli.Less(renderedArticle) + command := exec.Command("less", + "--RAW-CONTROL-CHARS", + "--pattern="+unicode.ZeroWidthSpace, + "--ignore-case", + "--tilde", + "--use-color", + "-P?e"+"\u001B[48;5;237m "+"\u001B[38;5;200m"+"e"+"\u001B[38;5;214m"+"n"+"\u001B[38;5;69m"+"d "+"\033[0m", + "-DSy", + "-DP-") + command.Stdin = strings.NewReader(renderedArticle) + command.Stdout = os.Stdout + + if err := command.Run(); err != nil { + panic(err) + } }