color
go-prompt
Our great sponsors
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
color
-
Cli colors disappear when piping into a text file
So i have a cli tool thats outputting some text to the cli stdout, i would like the output to be colored, so i used a library called color (github.com/fatih/color), basically the problem is when i output to stdout its fine but when i do something like ./tool | tee -a file.txt the colors disappear from terminal and also not in the output file, why is that and how do i prevent that ?
-
Snob - Dev Log (How it's done)
printer.go - Handles printing (showing) information to the user. This is where fatih/color is being used, so we can print pretty information with colors.
-
Simple CLI Colorizing in Go
Note, you also need to handle piping to other programs or sending output to a file. See the logic in https://github.com/fatih/color/blob/master/color.go, https://github.com/mattn/go-colorable and https://github.com/mattn/go-isatty.
-
Platform agnostic way to delete a line in the console?
The platform I'm using is Windows, and I found that prior to Win10 there was no support for ANSI escape codes in the command line, but I have Win10 and am pretty sure my version is up-to-date enough to have this support. I have also been successfully using Fatih's color package, so I had assumed that the escape codes were working. But they are not working when I do it manually, so fmt.Print("\033[F") does not work.
-
How to write idempotent Bash scripts
same person that wrote this module i use all the time. https://github.com/fatih/color ???
-
Go mod tidy problem.
I am using github.com/fatih/color as an example because it is a very simple library to test this problem out with.
-
First Go program - would love criticism: a small program that outputs VPN status, IP and emoji-flag
I would use bytes.Contains instead of string.Contains and I would use github.com/fatih/color for ansi colours rather than re-implienting it yourself. Best not to call log.Fatal in functions other than main - it makes testing hard. Instead they should return an error after their main return value.
-
ColorStyle is a library of styles for command-line text.
What’s the benefit over a well established library such as https://github.com/fatih/color ?
go-prompt
-
Is there a library that can give python-prompt-toolkit like completion for TUI?
Ref. https://github.com/prompt-toolkit/python-prompt-toolkit and https://github.com/c-bata/go-prompt ?
-
Is there a terminal based "dialog" library?
has some nice options : https://github.com/c-bata/go-prompt seems to have all you want (but may be a bit more than you wish for though.)
-
How can I use stdin while piping data when using promptui?
I think we are drifting into semantics here. The request isnt really about application design/use cases, nor am I am fan of running commands directly from code. If you notice, myapp in the example case is the final command, so interactivity isnt the breaker. The question is far simpler; this is doable in other langs or when using packages like github.com/c-bata/go-prompt
-
Library for developing CLI application with run-time command parsing like a shell
Have you hade a look at https://github.com/c-bata/go-prompt ?
-
Bit (1.0) – a modern Git CLI in Go
Bit uses cobra a little but for the autocomplete it uses https://github.com/c-bata/go-prompt
What are some alternatives?
chalk - Intuitive package for prettifying terminal/console output. http://godoc.org/github.com/ttacon/chalk
gocui - Minimalist Go package aimed at creating Console User Interfaces.
termui - Golang terminal dashboard
aurora - Golang ultimate ANSI-colors that supports Printf/Sprintf methods
Rich Interactive Widgets for Terminal UIs - Terminal UI library with rich, interactive widgets — written in Golang
termbox-go - Pure Go termbox implementation
pterm - ✨ #PTerm is a modern Go module to easily beautify console output. Featuring charts, progressbars, tables, trees, text input, select menus and much more 🚀 It's completely configurable and 100% cross-platform compatible.
clui - Command Line User Interface (Console UI inspired by TurboVision)
tcell - Tcell is an alternate terminal package, similar in some ways to termbox, but better in others.
Git Town - Additional Git commands for easier branch management and support for stacked changes