All Projects → serkonda7 → termtable

serkonda7 / termtable

Licence: MIT license
Simple and highly customizable library to display tables in the terminal.

Programming Languages

V
68 projects
AMPL
153 projects

Projects that are alternatives of or similar to termtable

vbf
A brainfuck interpreter/compiler written in V.
Stars: ✭ 17 (-58.54%)
Mutual labels:  v, vlang
ctable
C library to print nicely formatted tables
Stars: ✭ 13 (-68.29%)
Mutual labels:  ascii, table
minesweeper-v
Minesweeper Written in Vlang
Stars: ✭ 19 (-53.66%)
Mutual labels:  v, vlang
boundstone
High Performance / Fast Compilation / Lightweight MCBE Server
Stars: ✭ 42 (+2.44%)
Mutual labels:  v, vlang
Terminaltables
Generate simple tables in terminals from a nested list of strings.
Stars: ✭ 685 (+1570.73%)
Mutual labels:  ascii, table
discord.v
Discord Bot Framework written in V
Stars: ✭ 83 (+102.44%)
Mutual labels:  v, vlang
table
Produces a string that represents slice data in a text table, inspired by gajus/table.
Stars: ✭ 130 (+217.07%)
Mutual labels:  ascii, table
v-mode
🌻 An Emacs major mode for the V programming language.
Stars: ✭ 49 (+19.51%)
Mutual labels:  v, vlang
Ascii Tables
Quickly format table in ASCII. Great for code comments, or Github Markdown!
Stars: ✭ 416 (+914.63%)
Mutual labels:  ascii, table
Simpletable
Simple tables in terminal with Go
Stars: ✭ 288 (+602.44%)
Mutual labels:  ascii, table
vredis
Redis client for V, written in V
Stars: ✭ 43 (+4.88%)
Mutual labels:  v, vlang
Markdown Table
Markdown tables, with alignment
Stars: ✭ 164 (+300%)
Mutual labels:  ascii, table
jni
V wrapper around the C Java Native Interface
Stars: ✭ 15 (-63.41%)
Mutual labels:  v, vlang
vast
A simple tool for vlang, generate v source file to AST json file
Stars: ✭ 23 (-43.9%)
Mutual labels:  v, vlang
vargs
Simple argument parsing library for V.
Stars: ✭ 36 (-12.2%)
Mutual labels:  v, vlang
outfancy
Python3 library to print tables in Terminal.
Stars: ✭ 47 (+14.63%)
Mutual labels:  ascii, table
v2048
A simple game of 2048, written in V.
Stars: ✭ 19 (-53.66%)
Mutual labels:  v, vlang
registry
Package registry for vpkg
Stars: ✭ 13 (-68.29%)
Mutual labels:  v, vlang
Libfort
C/C++ library to create formatted ASCII tables for console applications
Stars: ✭ 255 (+521.95%)
Mutual labels:  ascii, table
Go Pretty
Pretty print tables and more in golang!
Stars: ✭ 777 (+1795.12%)
Mutual labels:  ascii, table

V Terminal Tables

CI

Simple and highly customizable library to display tables in the terminal.

Features

Installation

v install serkonda7.termtable

Usage

import serkonda7.termtable as tt

fn main() {
	data := [
		['Name', 'Age', 'Sex'],
		['Max', '13', 'male'],
		['Moritz', '12', 'male'],
		['Lisa', '42', 'female'],
	]
	t := tt.Table{
		data: data
		// The following settings are optional and have these defaults:
		style: .grid
		header_style: .bold
		align: .left
		orientation: .row
		padding: 1
		tabsize: 4
	}
	println(t)
}

Predefined Styles

Supported values for style: ... are:

  • .grid
  • .pretty
  • .plain
  • .simple
  • .fancy_grid
  • .md
  • .rst

.grid (default):

.pretty:

.plain:

.simple:

.fancy_grid:

.md follows the conventions of Markdown. It does not add alignment colons though:

.rst behaves like the reStructuredText simple table format:

Header Style

// header_style: ...
.bold (default) .plain

Alignment

// align: ...
| Max    | 13  | male   |  // .left (default)
|  Max   | 13  |  male  |  // .center
|    Max |  13 |   male |  // .right

Orientation

t := tt.Table{
	data: [
		['Name', 'Age'],
		['Max', '13'],
		['Moritz', '12'],
	]
	// orientation: ...
}
println(t)
.row (default) .column

Padding

Control the count of spaces between the cell border and the item.

// padding: ...
|   Lisa   |   42   |   female   |  // 3

| Lisa | 42 | female |  // 1 (default)

|Lisa|42|female|  // 0

Tabsize

t := tt.Table{
	data: [
		['\tName', 'Sex'],
		['1.\tMax', 'male\t'],
		['2. \tMoritz', '\tmale'],
	]
	// tabsize: ...
}
println(t)
4 (default) 2 8

Creating Custom Styles

To create a custom style set the tables style property to style: .custom and specify custom_style: tt.StyleConfig{...}.

StyleConfig Struct

topline      tt.Sepline{...}
headerline   tt.Sepline{...}
middleline   tt.Sepline{...}
bottomline   tt.Sepline{...}
colsep       string
fill_padding bool = true

Sepline Struct

left  string
right string
cross string
sep   string

Acknowledgements

License

Licensed under the MIT License

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].