hierarchical progress bars in terminal on steroids

Echelon - hierarchical progress in terminals

Build Status

Cross-platform library to organize logs in a hierarchical structure.

Here is an example how it looks for running Dockerized tasks via Cirrus CLI:

Cirrus CLI Demo

Features

  • Customizable and works with any VT100 compatible terminal
  • Supports simplified output for dumb terminals
  • Implements incremental drawing algorithm to optimize drawing performance
  • Can be used from multiple goroutines
  • Pluggable and customizable renderers
  • Works on Windows!

Example

Please check demo folder for a simple example or how echelon is used in Cirrus CLI.

Comments
  • Render raw message

    Render raw message

    Change:

    • added RenderRawMessage func
    • added Write func for satisfying io.Writer interface

    Reason:

    For some functions, need to pass io.Writer. For example:

    func DisplayJSONMessagesStream(in io.Reader, out io.Writer, terminalFd uintptr, isTerminal bool, auxCallback func(JSONMessage))
    

    asciicast

  • Add disable color for simple renderer

    Add disable color for simple renderer

    Changes

    • ~Add new func NewSimpleRendererWithoutColor~
    • Add new color schema NoColorSchema()
    • Change FinishTypeFailed color from NeutralColor to FailureColor (if this intended, I will change this back)

    Reason

    Using current NewSimpleRenderer, if we pipe or log it to file it will print the ANSI color codes. image

    So for my use case, I want to use NewInteractiveRenderer in my development and use NewSimpleRenderer in the production but it will print ANSI color codes in the log.

    ~Here is the result if we use NewSimpleRendererWithoutColor.~ Now we can use it like this

    import (
    	"github.com/cirruslabs/echelon/renderers"
    	"github.com/cirruslabs/echelon/terminal"
    )
    
    renderers.NewSimpleRenderer(os.Stdout, terminal.NoColorSchema())
    

    image

    Thank you

  • Data race

    Data race

    I have some unit tests on some code that uses echelon and it spit this out with -race.

    Looks like the len(node.Children) at https://github.com/cirruslabs/echelon/blob/master/renderers/internal/node/echelone_node.go#L134 needs to be protected by mutex.

    ==================
    WARNING: DATA RACE
    Write at 0x00c0001386a8 by goroutine 10:
      github.com/cirruslabs/echelon/renderers/internal/node.(*EchelonNode).FindOrCreateChild()
          /data/app/kochiku-worker/go/pkg/mod/github.com/cirruslabs/[email protected]/renderers/internal/node/echelone_node.go:194 +0x2bd
      github.com/cirruslabs/echelon/renderers.findScopedNode()
          /data/app/kochiku-worker/go/pkg/mod/github.com/cirruslabs/[email protected]/renderers/interactive.go:43 +0xb0
      github.com/cirruslabs/echelon/renderers.(*InteractiveRenderer).RenderScopeStarted()
          /data/app/kochiku-worker/go/pkg/mod/github.com/cirruslabs/[email protected]/renderers/interactive.go:49 +0x67
      github.com/cirruslabs/echelon.(*Logger).streamEntries()
          /data/app/kochiku-worker/go/pkg/mod/github.com/cirruslabs/[email protected]/logger.go:46 +0x182
    
    Previous read at 0x00c0001386a8 by goroutine 9:
      github.com/cirruslabs/echelon/renderers/internal/node.(*EchelonNode).fancyTitle()
          /data/app/kochiku-worker/go/pkg/mod/github.com/cirruslabs/[email protected]/renderers/internal/node/echelone_node.go:134 +0x82
      github.com/cirruslabs/echelon/renderers/internal/node.(*EchelonNode).Render()
          /data/app/kochiku-worker/go/pkg/mod/github.com/cirruslabs/[email protected]/renderers/internal/node/echelone_node.go:100 +0x6a
      github.com/cirruslabs/echelon/renderers.(*InteractiveRenderer).DrawFrame()
          /data/app/kochiku-worker/go/pkg/mod/github.com/cirruslabs/[email protected]/renderers/interactive.go:94 +0x1aa
      github.com/cirruslabs/echelon/renderers.(*InteractiveRenderer).StartDrawing()
          /data/app/kochiku-worker/go/pkg/mod/github.com/cirruslabs/[email protected]/renderers/interactive.go:75 +0x74
    =================
    
  • NewInteractiveRenderer takes a os.File instead of a io.Writer

    NewInteractiveRenderer takes a os.File instead of a io.Writer

    There is no logic in NewInteractiveRenderer() that depends on out being a file, but unfortunately this can't be changed without a 2.x release. Can an additional function be added to handle this case? I can submit the PR for it

    func NewInteractiveRenderer2(out io.Writer, rendererConfig *config.InteractiveRendererConfig) *InteractiveRenderer
    
  • Ugly output in short terminal windows

    Ugly output in short terminal windows

    Seems there is an issue when terminal window doesn't have too many lines available. Reported from this Reddit comment:

    Ah echelon tries to keep the job levels at the top of the currently-visible portion of the console, this is interesting. This only is an issue in case there are too many log lines. This makes the output very ugly though, apart from the last few lines. Just try the demo with passing false to all log.Finish calls.

    Example for the issue:

    πŸ•’ Job 1 37s
    πŸ•’ Job 1 38s
       ❌ Job 4 8.0s
    πŸ•’ Job 1 39s
          Doing very important jobs! Completed 25/100...
    πŸ•’ Job 1 40s
    πŸ•’ Job 1 41s
    πŸ•’ Job 1 42s
    πŸ•’ Job 1 43s
          Doing very important jobs! Completed 87/100...
    πŸ•’ Job 1 44s
          
    πŸ•’ Job 1 45s
    πŸ•’ Job 1 46s
    πŸ•’ Job 1 47s
    πŸ•’ Job 1 48s
    πŸ•’ Job 1 49s
       ❌ Job 8 9.0s
    
  • Add Simple Renderer Without Using ANSI Color

    Add Simple Renderer Without Using ANSI Color

    Issue

    Using current NewSimpleRenderer, if we pipe or log it to file it will print the ANSI color codes. image

    So for my use case, I want to use NewInteractiveRenderer in my development and use NewSimpleRenderer in the production but it will print ANSI color codes in the log.

    Expected

    image

    Related PR #18.

  • Support status customization

    Support status customization

    Right now it's only possible to configure colors and progress indicator. Once there are more cases of echelon usage we need think of a generic way for customization of scope statuses. (replace βœ… and ❌ with something different)

  • Expose renderer + SimpleRenderer RenderRawMessage method

    Expose renderer + SimpleRenderer RenderRawMessage method

    See https://github.com/cirruslabs/cirrus-cli/issues/489.

    The rest is implemented on the CLI's side: https://github.com/cirruslabs/cirrus-cli/pull/500.

  • Use lock only for public methods

    Use lock only for public methods

    Since it's not allowed to recursively use RWMutex let's make a contract that only public methods can acquire it and private methods can't use it.

    Fixes race in #14

  • flush buffer when stopping renderer

    flush buffer when stopping renderer

    Otherwise the last few bytes might not get written. The last fix https://github.com/cirruslabs/echelon/pull/12 didn't always work because the buffer might not get flushed before exiting.

Related tags
OTF font with vertical bars for one-line ASCII spectrum analyzers, graphs, etc
OTF font with vertical bars for one-line ASCII spectrum analyzers, graphs, etc

graph-bars-font OTF font with vertical bars for one-line ASCII spectrum analyzers, graphs, etc. I didn't find anything similar on the net so I decided

Jul 28, 2022
Golang library with POSIX-compliant command-line UI (CLI) and Hierarchical-configuration. Better substitute for stdlib flag.
Golang library with POSIX-compliant command-line UI (CLI) and Hierarchical-configuration. Better substitute for stdlib flag.

cmdr cmdr is a POSIX-compliant, command-line UI (CLI) library in Golang. It is a getopt-like parser of command-line options, be compatible with the ge

Oct 28, 2022
progress_bar creates a single customizable progress bar for Linux terminal.
progress_bar creates a single customizable progress bar for Linux terminal.

progress_bar Go Progress Bar Features progress_bar creates a single customizable progress bar for Linux terminal. Installation go get -u github.com/er

Aug 12, 2022
Go (golang) package with 70+ configurable terminal spinner/progress indicators.
Go (golang) package with 70+ configurable terminal spinner/progress indicators.

Spinner spinner is a simple package to add a spinner / progress indicator to any terminal application. Examples can be found below as well as full exa

Dec 26, 2022
Print day progress in your terminal

Day progress Print day progress in your terminal Install go install github.com/tsivinsky/day-progress@latest Usage day-progress By default, day-progre

Jan 10, 2022
A really basic thread-safe progress bar for Golang applications
A really basic thread-safe progress bar for Golang applications

progressbar A very simple thread-safe progress bar which should work on every OS without problems. I needed a progressbar for croc and everything I tr

Jan 1, 2023
Console progress bar for Golang

Terminal progress bar for Go Installation go get github.com/cheggaaa/pb/v3 Documentation for v1 bar available here Quick start package main import (

Jan 9, 2023
multi progress bar for Go cli applications

Multi Progress Bar mpb is a Go lib for rendering progress bars in terminal applications. Features Multiple Bars: Multiple progress bars are supported

Dec 28, 2022
Go simple progress bar writing to output
Go simple progress bar writing to output

?? progress-go Go simple progress bar writing to output ?? ABOUT Contributors: RafaΕ‚ Lorenz Want to contribute ? Feel free to send pull requests! Have

Oct 30, 2022
Golang-video-screensaver - A work in progress Microsoft Windows video screensaver implemented in Go

golang-video-screensaver A work in progress Microsoft Windows video screensaver

Sep 5, 2022
Stonks is a terminal based stock visualizer and tracker that displays realtime stocks in graph format in a terminal.
Stonks is a terminal based stock visualizer and tracker that displays realtime stocks in graph format in a terminal.

Stonks is a terminal based stock visualizer and tracker. Installation Requirements: golang >= 1.13 Manual Clone the repo Run make && make install Pack

Dec 16, 2022
Terminal client for SimpleNote

GoNote - Terminal client for SimpleNote GoNote is a simple utility for managing notes in your SimpleNote account. It allows basic operations like crea

Nov 22, 2022
gomerge is a tool to quickly bulk merge several pull requests from your terminal.
gomerge is a tool to quickly bulk merge several pull requests from your terminal.

Gomerge is a tool to quickly enable you to bulk merge Github pull requests from your terminal. The intention of this tool is to simplfy, and eventually automate the merging of github pull requests. This tool should be able to run on most systems.

Dec 28, 2022
`tmax` is a powerful tool to help you get terminal cmd directly.
`tmax`  is a powerful tool to help you get terminal cmd directly.

The positioning of tmax is a command line tool with a little artificial intelligence. If you frequently deal with the terminal daily, tmax will greatly improve your work efficiency.

Oct 15, 2022
YouTube client on your terminal

MeowTube YouTube client on your terminal Table of Contents About Getting Started Usage Contributing About MeowTube is a CLI (Command Line Interface) t

Jul 29, 2022
πŸŽ„ A Christmas tree right from your terminal!
πŸŽ„ A Christmas tree right from your terminal!

ctree ?? A Christmas tree right from your terminal! ?? Demo βŒ› No Refresh Don't want the tree to refresh every 2 seconds? Easy! Just add the --no-refre

Dec 20, 2022
A terminal based typing test.
A terminal based typing test.

What A terminal based typing test. Installation Linux sudo curl -L https://github.com/lemnos/tt/releases/download/v0.4.0/tt-linux -o /usr/local/bin/tt

Dec 28, 2022
Raspberry Pi terminal based activity monitor
Raspberry Pi terminal based activity monitor

pitop Raspberry Pi terminal based activity monitor Yes I know there are plenty of solutions already available, but I wanted to build my own terminal b

Dec 11, 2022
β“πŸ–Ό Find the anime scene by image using your terminal
β“πŸ–Ό Find the anime scene by image using your terminal

What Anime CLI ❓ ?? > This application is basically a ?? wrapper around trace.moe PREVIEW Usage ?? Get Anime By Image File ?? what-anime file anime.jp

Jan 2, 2023