Skip to content

C0DE8/bmfmt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bmfmt Golang [b]eautify [m]ap display [fmt] for Humans

MIT license Maintenance Github all releases Build Status

Install

# stable version
go get -u -v gopkg.in/c0de8/bmfmt.v0

# latest version (may be unstable)
go get -u -v github.com/c0de8/bmfmt

Supported Structures

  • map[string]string
  • map[string][]string

More structures are in implementation.

Usage

API Documentation

Examples

package main

import (
	"fmt"
	bmfmt "github.com/c0de8/bmfmt"
)

func main() {
	example()
}

func example() {

	m := map[string][]string{
		"some-key": { "response" },
		"Another-Hash-Key": { "first value", "second value" },
	}

	fmt.Println(m) // fmt the default formatting
	/*
         map[some-key:[response] Another-Hash-Key:[first value second value]]
	*/

	err := bmfmt.Beautify(m) // significant more friendly formatting
	if err != nil {
		fmt.Println("ERROR (bmfmt.Beautify): " + err.Error())
	}
	/*
         [ "some-key"          string(  8) ]: "response"                     string(  8)
         [ "Another-Hash-Key"  string( 16) ]: "first value", "second value"  string( 23)
	*/

}

License

bmfmt is licensed under the MIT License. See LICENSE for the full license text.