Terminal based dashboard.

Doc Status Build Status Sourcegraph Coverage Status Go Report Card License Mentioned in Awesome Go

termdashlogo

Termdash is a cross-platform customizable terminal based dashboard.

termdashdemo

The feature set is inspired by the gizak/termui project, which in turn was inspired by yaronn/blessed-contrib.

This rewrite focuses on code readability, maintainability and testability, see the design goals. It aims to achieve the following requirements. See the high-level design for more details.

Public API and status

The public API surface is documented in the wiki.

Private packages can be identified by the presence of the /private/ directory in their import path. Stability of the private packages isn't guaranteed and changes won't be backward compatible.

There might still be breaking changes to the public API, at least until the project reaches version 1.0.0. Any breaking changes will be published in the changelog.

Current feature set

  • Full support for terminal window resizing throughout the infrastructure.
  • Customizable layout, widget placement, borders, margins, padding, colors, etc.
  • Dynamic layout changes at runtime.
  • Binary tree and Grid forms of setting up the layout.
  • Focusable containers and widgets.
  • Processing of keyboard and mouse events.
  • Periodic and event driven screen redraw.
  • A library of widgets, see below.
  • UTF-8 for all text elements.
  • Drawing primitives (Go functions) for widget development with character and sub-character resolution.

Installation

To install this library, run the following:

go get -u github.com/mum4k/termdash
cd github.com/mum4k/termdash

Usage

The usage of most of these elements is demonstrated in termdashdemo.go. To execute the demo:

go run termdashdemo/termdashdemo.go

Documentation

Please refer to the Termdash wiki for all documentation and resources.

Implemented Widgets

The Button

Allows users to interact with the application, each button press runs a callback function. Run the buttondemo.

go run widgets/button/buttondemo/buttondemo.go

buttondemo

The TextInput

Allows users to interact with the application by entering, editing and submitting text data. Run the textinputdemo.

go run widgets/textinput/textinputdemo/textinputdemo.go

textinputdemo

Can be used to create text input forms that support keyboard navigation:

go run widgets/textinput/formdemo/formdemo.go

formdemo

The Gauge

Displays the progress of an operation. Run the gaugedemo.

go run widgets/gauge/gaugedemo/gaugedemo.go

gaugedemo

The Donut

Visualizes progress of an operation as a partial or a complete donut. Run the donutdemo.

go run widgets/donut/donutdemo/donutdemo.go

donutdemo

The Text

Displays text content, supports trimming and scrolling of content. Run the textdemo.

go run widgets/text/textdemo/textdemo.go

textdemo

The SparkLine

Draws a graph showing a series of values as vertical bars. The bars can have sub-cell height. Run the sparklinedemo.

go run widgets/sparkline/sparklinedemo/sparklinedemo.go

sparklinedemo

The BarChart

Displays multiple bars showing relative ratios of values. Run the barchartdemo.

go run widgets/barchart/barchartdemo/barchartdemo.go

barchartdemo

The LineChart

Displays series of values on a line chart, supports zoom triggered by mouse events. Run the linechartdemo.

go run widgets/linechart/linechartdemo/linechartdemo.go

linechartdemo

The SegmentDisplay

Displays text by simulating a 16-segment display. Run the segmentdisplaydemo.

go run widgets/segmentdisplay/segmentdisplaydemo/segmentdisplaydemo.go

segmentdisplaydemo

Contributing

If you are willing to contribute, improve the infrastructure or develop a widget, first of all Thank You! Your help is appreciated.

Please see the CONTRIBUTING.md file for guidelines related to the Google's CLA, and code review requirements.

As stated above the primary goal of this project is to develop readable, well designed code, the functionality and efficiency come second. This is achieved through detailed code reviews, design discussions and following of the design guidelines. Please familiarize yourself with these before contributing.

If you're developing a new widget, please see the widget development section.

Termdash uses this branching model. When you fork the repository, base your changes off the devel branch and the pull request should merge it back to the devel branch. Commits to the master branch are limited to releases, major bug fixes and documentation updates.

Similar projects in Go

Projects using Termdash

  • datadash: Visualize streaming or tabular data inside the terminal.
  • grafterm: Metrics dashboards visualization on the terminal.
  • perfstat: Analyze and show tips about possible bottlenecks in Linux systems.
  • gex: Cosmos SDK explorer in-terminal.

Disclaimer

This is not an official Google product.

Comments
  • Y-axis label formatter for LineChart

    Y-axis label formatter for LineChart

    This PR fixes #187

    Adds the ability to set custom labels on the Y-axis using a value formatter that accepts a numeric value (float64) and returns the corresponding label to this value (string).

    The PR is in WIP state. I'll update the PR accordingly.

    Steps:

    • [x] Set the Linechart Y-axis option with the ValueFormatter.
    • [x] Use the formatter on the Value if is present.
    • [x] Create formatter for most common time units.
    • [x] Create formatter to round values (#95).

    This approach seems to work fine, I put an image of the project that I'm developing (a Grafana for terminal that I'll make it public soon) using this feature.

  • termdash makes debugging panics difficult

    termdash makes debugging panics difficult

    By default, when a termdash program panics, the panic is not printed to the output.

    Is there some way to intercept the panic to print it to a log file?

  • Update tcell to the latest 2.x version

    Update tcell to the latest 2.x version

    Changelog: https://github.com/gdamore/tcell/blob/master/CHANGESv2.adoc

    And while we are at it, we can also consider making tcell the default in all code examples.

  • Font modifier cell options (bold, italic, underline)

    Font modifier cell options (bold, italic, underline)

    It's currently not possible to set text as bold, italic, underline, or strikethrough.

    | Modifier | ANSI | |-|-| | Bold | \e[1m | | Italics | \e[3m | | Underline | \e[4m | | Strikethrough | \e[9m |

  • What are the keyboard shortcuts for changing widget focus?

    What are the keyboard shortcuts for changing widget focus?

    Good day. This wiki article says:

    "Focus can be changed using mouse or keyboard shortcuts." https://github.com/mum4k/termdash/blob/master/doc/hld.md

    I'm working with a terminal without mouse support. What are the shortcuts for changing focus? Thanks.

  • Does not render on Windows Terminal (preview)

    Does not render on Windows Terminal (preview)

    Currently using https://github.com/microsoft/terminal from the window's app store (which is still in preview since it has not officially released yet) on my Windows machine.

    I'm trying to make a cross-platform terminal application but it doesn't seem to work at all through Windows Terminal, regardless of the underlying shell I use (e.g. neither cmd nor powershell work when launched through Windows Terminal).

    I am aware that termbox-go does not work through mintty or cygwin, but I can confirm that termbox-go and termui do work through the new Windows Terminal application.

    Here is an example of a termui application running in windows terminal: image

    However when I try to build the TextInputDemo as an executable and run this through Windows Terminal, it does not show up at all.

    image

    It simply shows a flashing cursor at the top left.

  • Allow the user to request an unscaled X axis on the LineChart

    Allow the user to request an unscaled X axis on the LineChart

    Hello,

    [Category: Question]

    As I mentioned before - fantastic work so far! One thing I found might be missing would be a way to get the width of the lineChart for when you implement scrolling behavior.

    I see some functions under Container which might be helpful, is there a way to return the effective width of the linechart itself (the piece where braille gets drawn to the screen [the canvas])? Right now I use a hacky method where the ui.TerminalDimensions() function is called from the termUI library to take the 85 percent of the total terminal width (because the linechart container takes up 85 percent plus another 15 percent for the text box). I'd like to remove the termUI dependency entirely and somehow find the width of the canvas.

    termWidth, termHeight := ui.TerminalDimensions()
    termWidth = int((float64(termWidth)*float64(0.85)))
    

    Thanks! Keith

  • add font modifier cell options: bold, italic, underline.

    add font modifier cell options: bold, italic, underline.

    This PR adds cell options for the font modifiers bold, italic, and underline.

    tcell was upgraded 1.4.0.

    Strikethrough cell option was added as a no-op until tcell is updated to v2.0.0. I figured it wasn't a good idea to upgrade tcell by a whole major version without testing.

    Closes #251

  • Add Tcell implementation for terminal backend

    Add Tcell implementation for terminal backend

    Adds the option to use https://github.com/gdamore/tcell as the terminal screen. This PR also addresses #223, being that tcell enables proper rendering on Windows devices (including Windows Terminal).

    Fixes #100. Fixes #223.

  • panic: line style LineStyleLight line part linePartHAndUp is a rune ┴ with width 2, all parts must be half-width runes (width of one)

    panic: line style LineStyleLight line part linePartHAndUp is a rune ┴ with width 2, all parts must be half-width runes (width of one)

    Hi, I run the code from https://github.com/mum4k/termdash/blob/master/widgets/gauge/gaugedemo/gaugedemo.go in my Mac, but it panic:

    panic: line style LineStyleLight line part linePartHAndUp is a rune ┴ with width 2, all parts must be half-width runes (width of one)
    
    goroutine 1 [running]:
    github.com/mum4k/termdash/draw.init.0()
    	/Users/pathbox/gowork/src/github.com/mum4k/termdash/draw/line_style.go:76 +0x294
    exit status 2
    

    I don't know the reason

    It can't run in macOS(10.14.3) ?

    I try another demo, the same question is happened,too.

    I find the source code is:

    func init() {
    	for ls, parts := range lineStyleChars {
    		for part, r := range parts {
    			if got := runewidth.RuneWidth(r); got > 1 {
    				panic(fmt.Errorf("line style %v line part %v is a rune %c with width %v, all parts must be half-width runes (width of one)", ls, part, r, got))
    			}
    		}
    	}
    }
    

    It seems that it is about rune width of the hAndUp '┴', I don't know how to solve it

  • Add support for fixed size container splits.

    Add support for fixed size container splits.

    This PR adds support for setting fixed heights to containers that split horizontally.


    Examples: Calling

    container.SplitHorizontal(
    	container.Top(...),
    	container.Bottom(...),
    	container.FixHeight(3, 15)
    )
    

    will set the top container to be 3 in line height and 15 on the bottom container.

    To make the containers fill the rest of the space, you set the args to -1, example:

    container.SplitHorizontal(
    	container.Top(...),
    	container.Bottom(...),
    	container.FixHeight(3, -1)
    )
    

    which will make top container 3 and make the bottom container take up rest of the space that is available.

  • Gauge threshold

    Gauge threshold

    This PR introduces the option gauge.Threshold which allows you to draw a vertical line on a gauge representing a threshold. If the gauge is drawn with a border the threshold is drawn over the border, otherwise it's only drawn within the gauge itself. The threshold is only drawn if its value is within the gauge (greater than 0 and less than g.total).

    I took the liberty to change the demo to draw a threshold on two of the gauges. image

  • panic: unknown tcell event type: <nil>

    panic: unknown tcell event type:

    I get this error every time I try to quit (by pressing 'q'). It also leaves the terminal window in an unusable state. Where do i start debugging this? The stack trace doesnt even list any of my code.

           quitter := func(k *terminalapi.Keyboard) {
               if k.Key == 'q' || k.Key == 'Q' {
                   term.Close()
               }
           }
    

    Full code is here: https://github.com/kmulvey/text2speech/blob/main/dashboard.go

    panic: unknown tcell event type: <nil>
    
    goroutine 59 [running]:
    github.com/mum4k/termdash.(*termdash).handleError(...)
    	/opt/code/go/pkg/mod/github.com/mum4k/[email protected]/termdash.go:252
    github.com/mum4k/termdash.(*termdash).subscribers.func1({0xb61960?, 0xc000118010?})
    	/opt/code/go/pkg/mod/github.com/mum4k/[email protected]/termdash.go:215 +0xd2
    github.com/mum4k/termdash/private/event.(*subscriber).callback(0xc00007e2c0, {0xb61960?, 0xc000118010?})
    	/opt/code/go/pkg/mod/github.com/mum4k/[email protected]/private/event/event.go:95 +0x31
    github.com/mum4k/termdash/private/event.(*subscriber).run(0xc00007e2c0, {0xb66b18, 0xc00007e200})
    	/opt/code/go/pkg/mod/github.com/mum4k/[email protected]/private/event/event.go:110 +0x5a
    created by github.com/mum4k/termdash/private/event.newSubscriber
    	/opt/code/go/pkg/mod/github.com/mum4k/[email protected]/private/event/event.go:89 +0x205
    
  • Bump github.com/mattn/go-runewidth from 0.0.13 to 0.0.14

    Bump github.com/mattn/go-runewidth from 0.0.13 to 0.0.14

    Bumps github.com/mattn/go-runewidth from 0.0.13 to 0.0.14.

    Commits
    • 2c6a438 Merge pull request #65 from tty2/feature/trim-prefix
    • 10a3ce9 add spaces == width+chWidth-w
    • 6dff02e change function name to TruncateLeft
    • b18c354 if pos < w: add empty chars
    • 669734a change tests to table-driven approach
    • 8f4e6bc change t.Run names
    • 01f382a change tail to prefix
    • f052c83 trim prefix
    • f9d5553 Merge pull request #62 from itchyny/fix-underscore-names
    • 011b00b Fix underscore names in tests
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • Bump github.com/gdamore/tcell/v2 from 2.5.1 to 2.5.3

    Bump github.com/gdamore/tcell/v2 from 2.5.1 to 2.5.3

    Bumps github.com/gdamore/tcell/v2 from 2.5.1 to 2.5.3.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • adding text styles has no effect on Windows

    adding text styles has no effect on Windows

    I am on the devel branch of termdash and I passed 4 different styles with text.WriteCellOpts to the text.Write call for testing the result. Except, I found only the blink style to be working, as seen in the attached image.

    image

    Is this an implementation issue at termdash's end or a bug in the upstream lib tcell?

    I also tested the same thing with termdash v0.16.0 which was before merging #329, but had the same outcome.

    image

    Shell: Powershell 7.2.5
    Terminal Emulator: Windows Terminal v1.13.11432.0
    OS: Windows 11
    

    PS: I know that the styling works on my device because golang-based OhMyPosh, which handles ANSI codes differently, works with all the 4 styles.

  • allow non-adaptive custom scale

    allow non-adaptive custom scale

    I've set linechart.YAxisCustomScale(-20, 20) and I want the position of 0 to always stay at the same place.

    Looking at the code, unfortunately the LineChart would still rescale the Y axis if a value is encountered that is outside of the range specified here

    To me it seems adaptive should be an entirely separate option.

    / YAxisCustomScale when provided, the scale of the Y axis will be based on the
    // specified minimum and maximum value instead of determining those from the
    // LineChart series. Useful to visually stabilize the Y axis for LineChart
    // applications that continuously feed values.
    // The default behavior is to continuously determine the minimum and maximum
    // value from the series before drawing the LineChart.
    // Even when this option is provided, the LineChart would still rescale the Y
    // axis if a value is encountered that is outside of the range specified here,
    // i.e. smaller than the minimum or larger than the maximum.
    // Both the minimum and the maximum must be valid numbers and the minimum must
    // be smaller than the maximum.
    //
    // Providing this option also sets YAxisAdaptive.
    func YAxisCustomScale(min, max float64) Option {
    	return option(func(opts *options) {
    		opts.yAxisCustomScale = &customScale{
    			min: min,
    			max: max,
    		}
    		opts.yAxisMode = axes.YScaleModeAdaptive
    	})
    }
    
Intuitive package for prettifying terminal/console output. http://godoc.org/github.com/ttacon/chalk
Intuitive package for prettifying terminal/console output. http://godoc.org/github.com/ttacon/chalk

chalk Chalk is a go package for styling console/terminal output. Check out godoc for some example usage: http://godoc.org/github.com/ttacon/chalk The

Dec 23, 2022
An ANSI colour terminal package for Go

colourize An ANSI colour terminal package for Go. Supports all ANSI colours and emphasis. Not compatible with Windows systems. Installation go get gi

Sep 26, 2022
Console Text Colors - The non-invasive cross-platform terminal color library does not need to modify the Print method

ctc - Console Text Colors The non-invasive cross-platform terminal color library does not need to modify the Print method Virtual unix-like environmen

Nov 9, 2022
Simple tables in terminal with Go

Simple tables in terminal with Go This package allows to generate and display ascii tables in the terminal, f.e.: +----+------------------+-----------

Dec 29, 2022
uilive is a go library for updating terminal output in realtime
uilive is a go library for updating terminal output in realtime

uilive uilive is a go library for updating terminal output in realtime. It provides a buffered io.Writer that is flushed at a timed interval. uilive p

Dec 28, 2022
A go library to render progress bars in terminal applications
A go library to render progress bars in terminal applications

uiprogress A Go library to render progress bars in terminal applications. It provides a set of flexible features with a customizable API. Progress bar

Dec 29, 2022
A go library to improve readability in terminal apps using tabular data

uitable uitable is a go library for representing data as tables for terminal applications. It provides primitives for sizing and wrapping columns to i

Dec 30, 2022
Yet Another CLi Spinner; providing over 70 easy to use and customizable terminal spinners for multiple OSes
Yet Another CLi Spinner; providing over 70 easy to use and customizable terminal spinners for multiple OSes

Yet Another CLi Spinner (for Go) Package yacspin provides yet another CLi spinner for Go, taking inspiration (and some utility code) from the https://

Dec 25, 2022
Terminal string styling for go done right, with full and painless Windows 10 support.
Terminal string styling for go done right, with full and painless Windows 10 support.

GChalk GChalk is a library heavily inspired by chalk, the popular Node.js terminal color library, and using go ports of supports-color and ansi-styles

Dec 28, 2022
Github-workflow-dashboard - WEB and CLI dashboard for github action workflows
Github-workflow-dashboard - WEB and CLI dashboard for github action workflows

CLI capable of retrieving github action workflows stats Example usage Dashboard

Aug 30, 2022
Terminal based dashboard.
Terminal based dashboard.

Termdash is a cross-platform customizable terminal based dashboard. The feature set is inspired by the gizak/termui project, which in turn was inspire

Dec 28, 2022
Terminal based dashboard.
Terminal based dashboard.

Termdash is a cross-platform customizable terminal based dashboard. The feature set is inspired by the gizak/termui project, which in turn was inspire

Jan 1, 2023
Golang terminal dashboard
Golang terminal dashboard

termui termui is a cross-platform and fully-customizable terminal dashboard and widget library built on top of termbox-go. It is inspired by blessed-c

Dec 27, 2022
:bento: Highly Configurable Terminal Dashboard for Developers and Creators
:bento: Highly Configurable Terminal Dashboard for Developers and Creators

DevDash is a highly configurable terminal dashboard for developers and creators who want to choose and display the most up-to-date metrics they need,

Jan 3, 2023
Golang terminal dashboard
Golang terminal dashboard

termui termui is a cross-platform and fully-customizable terminal dashboard and widget library built on top of termbox-go. It is inspired by blessed-c

Dec 29, 2022
The personal information dashboard for your terminal
The personal information dashboard for your terminal

WTF (aka 'wtfutil') is the personal information dashboard for your terminal, providing at-a-glance access to your very important but infrequently-need

Dec 31, 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
⛑ Gatus - Automated service health dashboard
⛑ Gatus - Automated service health dashboard

A service health dashboard in Go that is meant to be used as a docker image with a custom configuration file. I personally deploy it in my Kubernetes

Dec 31, 2022
Open Source HTTP Reverse Proxy Cache and Time Series Dashboard Accelerator
Open Source HTTP Reverse Proxy Cache and Time Series Dashboard Accelerator

Trickster is an HTTP reverse proxy/cache for http applications and a dashboard query accelerator for time series databases. Learn more below, and chec

Jan 2, 2023