• Stars
    star
    603
  • Rank 74,270 (Top 2 %)
  • Language
    Go
  • License
    MIT License
  • Created over 10 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Converts arbitrary shell output (with ANSI) into beautifully rendered HTML

logo

Terminal is a Go library for converting arbitrary shell output (with ANSI) into beautifully rendered HTML. See http://en.wikipedia.org/wiki/ANSI_escape_code for more information about ANSI Terminal Control Escape Sequences.

It provides a single command, terminal-to-html, that can be used to convert terminal output via STDIN, as well as via a simple web server.

GoDoc

Usage

Piping in terminal output via the command line:

cat fixtures/pikachu.sh.raw | terminal-to-html -preview > out.html

Posting terminal content via HTTP:

terminal-to-html -http=:6060 &
curl --data-binary "@fixtures/pikachu.sh.raw" http://localhost:6060/terminal > out.html

For coloring you can use the sample terminal.css stylesheet and wrap the output in an element with class term-container (e.g. <div class="term-container"><!-- terminal output --></div>).

iTerm2 Image support

Terminal has basic support for iTerm2 inline images. Only control sequences with inline=1 will be rendered and preserveAspectRatio is not supported.

URL-based images

Terminal also provides a way to refer to images from the internet rather than transmitted via ANSI. The format is similar to iTerm2 inline images but uses the escape code 1338:

1338;url=http://imgur.com/foo.gif;width=100%;height=50px;alt=My Image

You can use the provided image.sh to produce this escape sequence.

Links

Terminal can also render hyperlinks:

1339;url=https://google.com;content=Google Search

You can use the provided link.sh to produce this escape sequence.

Links which contain semicolons can be surrounded by either single or double quotation marks:

1339;url='https://example.com/link-with;semicolon?argument=something';content=Example

Installation

If you have Go installed you can simply run the following command to install the terminal-to-html command into $GOPATH/bin:

$ go install github.com/buildkite/terminal-to-html/v3/cmd/terminal-to-html

You can also just download the standalone binary from https://github.com/buildkite/terminal-to-html/releases

Developing

To get a bash prompt with all the go cross-compilation tools set up for you already:

$ docker build -t terminal . && docker run -it --rm -v $(pwd):/go/src/github.com/buildkite/terminal-to-html terminal bash

Benchmarking

Run go test -bench . to see raw Go performance. The npm test is the focus: this best represents the kind of use cases the original code was developed against.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Licence

Copyright (c) 2019 Keith Pitt, Tim Lucas, Michael Pearson

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

More Repositories

1

docker-puppeteer

A minimal Docker image for Puppeteer
Dockerfile
807
star
2

agent

The Buildkite Agent is an open-source toolkit written in Go for securely running build jobs on any device or network
Go
774
star
3

elastic-ci-stack-for-aws

An auto-scaling cluster of build agents running in your own AWS VPC
Shell
411
star
4

emojis

:shipit: Custom emoji supported by Buildkite which you can use in your build pipelines and terminal output.
Ruby
376
star
5

cli

A command line interface for Buildkite.
Go
167
star
6

lifecycled

A daemon for responding to AWS AutoScaling Lifecycle Hooks
Go
146
star
7

sockguard

A proxy for docker.sock that enforces access control and isolated privileges
Go
143
star
8

frontend

🌏 The front-end application code for https://buildkite.com
JavaScript
137
star
9

ecs-run-task

Run a once-off task on Amazon ECS and stream the output
Go
125
star
10

agent-stack-k8s

Spin up an autoscaling stack of Buildkite Agents on Kubernetes
Go
79
star
11

example-pipelines

A list of all the example Buildkite pipelines for various tools, languages and frameworks
77
star
12

go-buildkite

A Go library for the Buildkite API
Go
67
star
13

buildkite-agent-metrics

A command-line tool (and Lambda) for collecting Buildkite agent metrics
Go
66
star
14

buildkite-agent-scaler

📈A lambda for scaling an AutoScalingGroup based on Buildkite metrics
Go
61
star
15

github-release

A command line utility to create GitHub releases and upload packages
Go
60
star
16

charts

Buildkite Helm Charts repository
Shell
59
star
17

trigger-pipeline-action

A GitHub Action for triggering a build on a Buildkite pipeline.
Shell
58
star
18

terraform-provider-buildkite

Terraform provider for Buildkite
Go
56
star
19

docs

The source files for the Buildkite documentation
Ruby
45
star
20

nodejs-docker-example

An example of how to run a Node.js project in Docker in a Buildkite pipeline
Dockerfile
41
star
21

cloudformation-launch-stack-button-svg

A nice, resolution independent, SVG version of the AWS CloudFormation "Launch Stack" button 🎉
39
star
22

interpolate

Interpolate $STRINGS in ${OTHER_STRINGS:-true}
Go
32
star
23

python-docker-example

An example of how to run a Python project w/ Docker in a Buildkite pipeline
Dockerfile
32
star
24

pipeline-schema

A JSON schema for Buildkite’s pipeline file format
JavaScript
30
star
25

docker-ssh-env-config

Sets up SSH config files within a container based on environment variables
Shell
30
star
26

buildkite-signed-pipeline

[Deprecated] This is a tool that adds some extra security guarantees around Buildkite's jobs
Go
27
star
27

docker-buildkite-agent

Previous home of buildkite/agent docker image scripts
26
star
28

feedback

Got feedback? Please let us know!
25
star
29

capybara-inline-screenshot

Extends capybara-screenshot with inline image output
Ruby
24
star
30

elastic-ci-stack-s3-secrets-hooks

🕵️‍♀️ Expose secrets to your buildkite build steps via Amazon S3
Go
24
star
31

on-demand

CloudFormation resources for scheduling On-Demand Buildkite Agents with AWS ECS and AWS Fargate
JavaScript
23
star
32

bash-example

An example repository you can use as a test project with Buildkite
Shell
23
star
33

rails-docker-parallel-example

An example of how to run Rails CI and test steps in parallel with Docker and Buildkite
Ruby
21
star
34

iam-ssh-agent

Keyless SSH Agent for IAM Entities
Rust
20
star
35

golang-docker-example

An example of how to run a Golang project in Docker in a Buildkite pipeline
Go
19
star
36

dynamic-pipeline-example

An example of how to generate dynamic build pipelines in Buildkite
Shell
18
star
37

rspec-buildkite

RSpec failures as Buildkite annotations so you can fix them fast
Ruby
17
star
38

image-builder

Uses EC2 Image Builder to customise AMIs for elastic-ci-stack-for-aws Buildkite agents
JavaScript
16
star
39

test-collector-ruby

Buildkite Test Analytics collector for Ruby test frameworks
Ruby
16
star
40

buildkite-cloudwatch-metrics-publisher

Publish your Buildkite job queue statistics to AWS Cloud Watch for easy EC2 auto-scaling of your build agents
Makefile
16
star
41

elastic-ci-stack-for-aws-ecs

An experiment with AWS SpotFleets and ECS
Go
16
star
42

slack-webhook

An example Slack Outgoing Webhook for Buildkite
JavaScript
16
star
43

homebrew-buildkite

Homebrew formulae for Buildkite software
Ruby
16
star
44

dynamic-build-badges

Dynamic readme badges from your Buildkite build meta-data
JavaScript
16
star
45

anka-packer-images

Packer scripts for building MacOS images for Anka
Shell
15
star
46

python-pipenv-example

An example of how to run a Python project w/ pipenv in a Buildkite pipeline
Python
15
star
47

buildbox-agent-ruby

Buildbox agent written in Ruby
Ruby
14
star
48

build-trace

Generate trace data for a build in Jaeger
Go
13
star
49

heroku-buildkite-agent

A sample Heroku app for running the Buildkite agent on Heroku dynos
13
star
50

test-collector-javascript

Buildkite Test Analytics collectors for JavaScript test frameworks
JavaScript
13
star
51

golang-example

An example on how to test a Golang program using Buildkite
Go
13
star
52

yaml2json

An easy to use command line tool to convert YAML to JSON
Shell
12
star
53

block-step-example

An example of how to include block steps with form fields in your pipeline
Shell
12
star
54

nodejs-example

An example of how to run a Node.js project in a Buildkite pipeline
JavaScript
11
star
55

shellwords

Splits command strings according to POSIX/Batch semantics
Go
11
star
56

bintest

Golang tools for generating mock binaries for that can be orchestrated in realtime for testing
Go
11
star
57

rspec-junit-example

An example pipeline that collects JUnit test failures and annotates a Buildkite build
Ruby
11
star
58

buildkite-fastlane-demo

An example of running Xcode 7 unit, performance and UI tests using Fastlane and Buildkite
Ruby
9
star
59

roko

An easy to use, configurable retry library for Go
Go
9
star
60

statusbot

[ARCHIVED] 🤖 A status slackbot for interacting with statuspage.io
Go
9
star
61

buildkite-secret-santa-2016

Buildkite’s 2016 Secret Santa Draw, using dynamic build pipelines and Lambda webhook receivers
HTML
9
star
62

elastic-ci-stack-for-ec2-mac

CloudFormation template for Auto Scaling AWS EC2 Mac based Buildkite Agents
Makefile
9
star
63

test-collector-swift

Buildkite Test Analytics collector for Swift XCTest
Swift
9
star
64

migration

[Alpha Version] 🛠️ Based on Compat, a tool to transform pipelines from other CI providers to Buildkite
Ruby
8
star
65

go-pipeline

A way to define and manipulate buildkite pipelines using golang. Used internally by the buildkite-agent, so you know it's good
Go
8
star
66

figma-css-paste

Plugin to paste and apply CSS styles to your objects and frames in Figma
JavaScript
8
star
67

docker-signal-test

A test for whether `docker run` handles signals correctly
Shell
8
star
68

elastic-ci-stack-ssm-secrets-hooks

🕵️‍♀️ Agent hooks for fetching git credentials from Amazon SSM Parameter Store
Shell
8
star
69

ruby-docker-example

An example of how to run a Ruby project in Docker in a Buildkite pipeline
Ruby
8
star
70

test-engine-client

Buildkite Test Engine Client (bktec) is an open source tool to orchestrate your test suites. It uses your Buildkite Test Engine suite data to intelligently partition and parallelise your tests.
Go
8
star
71

lifx-buildkite-build-light-ruby

An example Ruby Buildkite webhook endpoint for creating a LIFX-powered build light
Ruby
8
star
72

dependent-pipeline-example

An example of how to trigger Buildkite pipelines from other pipelines
7
star
73

annotation-tester

📝 Test writing Buildkite annotation bodies directly
7
star
74

buildkite-anka-example

An example of running builds in an Anka VM
Shell
7
star
75

conditional

A small language for conditionals
Go
7
star
76

rails-parallel-example

An example of how to run Rails CI and test steps in parallel with Buildkite
Ruby
7
star
77

starter

An example pipeline to get started with Buildkite Pipelines.
7
star
78

demokite

A starter Buildkite repository showcasing some of Buildkite’s features using Dynamic Pipelines
Shell
6
star
79

compat

A tool to transform pipelines from other CI providers to Buildkite
Ruby
6
star
80

bazel-example

An example of how to run a Bazel project in a Buildkite pipeline https://github.com/buildkite/example-…
C++
6
star
81

test-collector-python

Python adapter for Buildkite Test Analytics
Python
6
star
82

graphql-explorer

Buildkite's GraphQL Explorer
JavaScript
6
star
83

simplecov-buildkite

Generate Buildkite annotations from your SimpleCov coverage reports when running your build on Buildkite
Ruby
6
star
84

test-collector-rust

Rust adapter for Buildkite Test Analytics which implements a parser and sender for Rust's JSON test output
Rust
6
star
85

codebuild-run-build

Runs Codebuild Build and streams the output via Cloudwatch Logs.
Go
6
star
86

docker-bootstrap-example

🐳Run your buildkite builds inside an ephemeral per-job container
Shell
5
star
87

deploy-confirm-block-step-example

An example Buildkite pipeline that uses dynamic steps to confirm deployments on Fridays
Shell
5
star
88

slack-slash-command

An example Slack Slash Command for Buildkite
JavaScript
5
star
89

kitesocial

A super basic not-Twitter, for interviews. DO NOT FORK: clone to your machine only.
Ruby
5
star
90

agent-tests

Various scripts to test Buildkite Agent
Shell
5
star
91

lifx-buildkite-build-light-webtask

An example Webtask webhook endpoint for creating a LIFX-powered build light with Buildkite
JavaScript
5
star
92

maven-example

This example uses Maven to run tests, build a package, and then uploads the package as a Buildkite artifact using the current stable Buildkite Agent
Java
5
star
93

ruby-rbenv-example

An example of how to run a Ruby project w/ rbenv in a Buildkite pipeline
Ruby
5
star
94

test-collector-android

Buildkite Test Analytics collector for Android test frameworks
Kotlin
4
star
95

lifx-buildkite-build-light-node

An example Node.js Buildkite webhook endpoint for creating a LIFX-powered build light
JavaScript
4
star
96

polyglot-co-demo-lambda

Lambda services for https://github.com/buildkite/polyglot-co-demo-lambda
JavaScript
4
star
97

build-status-badge-themes

The library of themes you can use to spruce up your Buildkite build status badges
4
star
98

github-webhook-rotate

A utility for rotating the pipeline webhooks used by github triggering builds
Go
4
star
99

screencast-examples

Example pipelines from the Buildkite screencast series
JavaScript
4
star
100

bash-parallel-example

An example of how to a bash script in parallel on Buildkite
Shell
4
star