common

command module
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2026 License: MIT Imports: 0 Imported by: 0

README

Common Library

Go Report Card shields shields shields

Introduction

Generic functions that would be handy while building your Golang utility.

This library stands on the shoulders of various libraries built by some awesome folks.

Installation

Get the latest version of GoCD sdk using go get command.

go get github.com/nikhilsbhat/common@latest

Get specific version of the same.

go get github.com/nikhilsbhat/common@v0.0.2

Usage

package main

import (
	"github.com/nikhilsbhat/common/renderer"
	"github.com/sirupsen/logrus"
	"log"
	"os"
)

type Object struct {
	Name string
	Date string
}

func main() {
	newObject := []Object{
		{Name: "nikhil", Date: "01-01-2024"},
		{Name: "john", Date: "01-02-2024"},
	}

	logger := logrus.New()
	render := renderer.GetRenderer(os.Stdout, logger, true, true, false, false, false)

	if err := render.Render(newObject); err != nil {
		log.Fatal(err)
	}
}

Above code should generate yaml as below:

---
- Date: 01-01-2024
  Name: nikhil
- Date: 01-02-2024
  Name: john

More example of the libraries can be found here.

Documentation

Overview

Package main is a placeholder root package for the module.

Directories

Path Synopsis
Package content provides helpers for identifying and converting serialized content.
Package content provides helpers for identifying and converting serialized content.
Package diff provides helpers to compare JSON and YAML data.
Package diff provides helpers to compare JSON and YAML data.
Package errors contains common error types used by this module.
Package errors contains common error types used by this module.
Package prompt provides helpers for reading and validating shell prompts.
Package prompt provides helpers for reading and validating shell prompts.
Package renderer provides output rendering and syntax highlighting helpers.
Package renderer provides output rendering and syntax highlighting helpers.

Jump to

Keyboard shortcuts

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