Documentation
¶
Overview ¶
Example (Output) ¶
package main
import (
"fmt"
"codeberg.org/japh/psv"
"codeberg.org/japh/psv/internal/column"
"codeberg.org/japh/psv/internal/ruler"
)
func main() {
t := psv.Table{
Prefix: ">> ",
}
t.AppendFields("size", "weight")
t.AppendRuler(ruler.FromTemplate("| -"))
t.AppendFields("1", "1")
t.AppendFields("2", "4")
t.AppendFields("3", "9")
t.AppendFields("4", "16")
t.Index.Column("weight").SetAlignment(column.AlignRightFlag)
fmt.Print(t.String())
}
Output: >> | size | weight | >> | ---- | ------ | >> | 1 | 1 | >> | 2 | 4 | >> | 3 | 9 | >> | 4 | 16 |
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TestArchive ¶
TestArchive wraps a *txtar.Archive and adds the filename of the archive
Use ar.ReadFileData( name ) []byte to get an archived file's data - []byte{} is returned if the archived file does not exist
See also as.HasFile( name ) to check for existence of a file in the archive
func TestArchives ¶
func TestArchives() []*TestArchive
TestArchives provides shared access to all .txtar files for testing etc in multiple packages
Usage:
for _, ar := range test.TestArchives() {
givenInput := ar.ReadFileData( "input" )
wantOutput := ar.ReadFileData( "output" )
gotOutput := doSomething( input )
if gotOutput != wantOutput {
...
}
}
Click to show internal directories.
Click to hide internal directories.