Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/liamg/tml
:rainbow::computer::art: A tiny markup language for terminal output. Makes formatting output in CLI apps easier!
https://github.com/liamg/tml
cli cli-app colors colours terminal terminal-ui tui
Last synced: 1 day ago
JSON representation
:rainbow::computer::art: A tiny markup language for terminal output. Makes formatting output in CLI apps easier!
- Host: GitHub
- URL: https://github.com/liamg/tml
- Owner: liamg
- License: unlicense
- Created: 2019-05-02T06:55:02.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-04-24T14:59:39.000Z (9 months ago)
- Last Synced: 2025-01-02T23:07:16.963Z (8 days ago)
- Topics: cli, cli-app, colors, colours, terminal, terminal-ui, tui
- Language: Go
- Homepage:
- Size: 53.7 KB
- Stars: 738
- Watchers: 7
- Forks: 19
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
- project-awesome - liamg/tml - :rainbow::computer::art: A tiny markup language for terminal output. Makes formatting output in CLI apps easier! (Go)
- awesome-repositories - liamg/tml - :rainbow::computer::art: A tiny markup language for terminal output. Makes formatting output in CLI apps easier! (Go)
README
# tml - Terminal Markup Language
[![Build Status](https://travis-ci.org/liamg/tml.svg "Travis CI status")](https://travis-ci.org/liamg/tml)
[![GoDoc](https://godoc.org/github.com/liamg/tml?status.svg)](https://godoc.org/github.com/liamg/tml)A Go module (and standalone binary) to make the output of coloured/formatted text in the terminal easier and more readable.
You can use it in your Go programs, and bash etc. too.
![Example screenshot](example.png)
## Usage in Go
The output of coloured/formatted text is easy using the following syntax:
```go
package mainimport "github.com/liamg/tml"
func main() {
tml.Printf("this text is red and the following is %s\n", "not red")
}
```## Usage in Bash
First, install tml:
Install Go and run the following command.
```
# For Go 1.16+
# Make sure that `$GOPATH/bin` is in your `$PATH`, because that's where this gets installedgo install github.com/liamg/tml/tml@latest
# For Go <1.16
go get -u github.com/liamg/tml/tml
```Then you can simply pipe text containing tags to tml:
```bash
#!/bin/bashecho "this text is red and the following is not red" | tml
```## Format
Each tag is enclosed in angle brackets, much like HTML.
You can nest tags as deeply as you like.
It's not required to close tags you've opened, though it can make for easier reading.
### Available Tags
#### Foreground Colours
- ``
- ``
- ``
- ``
- ``
- ``
- ``
- ``
- ``
- ``
- ``
- ``
- ``
- ``
- ``
- ``#### Background Colours
- ``
- ``
- ``
- ``
- ``
- ``
- ``
- ``
- ``
- ``
- ``
- ``
- ``
- ``
- ``
- ``#### Attributes
- ``
- ``
- ``
- ``
- ``
- ``
- ``
- ``