table

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 7, 2021 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package table provides functionality for displaying formatted tables based on tokens.

Copyright © 2021 Matthew Champagne <mmchamp95@gmail.com>

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Index

Constants

View Source
const DefaultFormat = "{id} {slug} {name} {downloads} {updated}"

DefaultFormat is the default format used for displaying search results.

Variables

This section is empty.

Functions

func SimpleTable

func SimpleTable(format Format, mods []mcf.Mod) *tablewriter.Table

SimpleTable returns a preformatted tablewriter.Table with minimal formatting.

func Table

func Table(format Format, mods []mcf.Mod) *tablewriter.Table

Table returns a tablewriter.Table using the specified Format and mod data.

Types

type Format

type Format string

Format is used to represent the desired mod table format to use through a string.

func (*Format) Headers

func (f *Format) Headers() (headers []string)

Headers returns the table header names for the Format. TODO: Allow this function to take in a token map to make this more generic.

func (*Format) Values

func (f *Format) Values(mod *mcf.Mod) (values []string)

Values returns the table values for a given mod and Format. TODO: Allow this function to take in a token map to make this more generic.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL