Skip to content

Commit fef4ee9

Browse files
committed
Updated readme to document new config type
1 parent 25165fe commit fef4ee9

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

README.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,26 @@ result, _ := columnize.SimpleFormat(output)
5757
fmt.Println(result)
5858
```
5959

60-
You can fine-tune the format of the output by calling the `Format` method. This
61-
lets you set spacing and delimiter selection.
60+
# Configuration
61+
62+
Columnize is configured using a `Config`, which can be obtained by calling the
63+
`DefaultConfig()` method. You can then tweak the settings in the resulting
64+
`Config`:
65+
66+
```
67+
config := columnize.DefaultConfig()
68+
config.Delim = "|"
69+
config.Glue = " "
70+
```
71+
72+
You can then pass the `Config` in using the `Format` method (signature below) to
73+
have text formatted to your liking.
6274

6375
Usage
6476
=====
6577

6678
```go
6779
SimpleFormat(intput interface{}) (string, error)
6880

69-
Format(input interface{}, delim string, space string) (string, error)
81+
Format(input interface{}, config *Config) (string, error)
7082
```

0 commit comments

Comments
 (0)