Git Product home page Git Product logo

dmidecode's Introduction

dmidecode

  • A decoder for dmidecode output

How to use

  • Create a new dmidecode struct
import "github.com/rawdaGastan/dmidecode/pkg"

dmi := pkg.NewDMIDecoder()
  • Get the dmidecode output
output, _ := dmi.GetDMIDecodeOutput()
  • Then decode it
dmi.Decode(output)

Functions

  • dmiDecode.Decode() → to get your decoded map
  • dmiDecode.GetSections() → to get your sections' names
  • dmiDecode.GetSection( sectionKey ) → to get the content of the specified section key
  • dmiDecode.GetOptions( sectionKey ) → to get the options of the specified section key
  • dmiDecode.Get( sectionKey, optionKey ) → to get the string value of an option key inside a section
  • dmiDecode.GetList( sectionKey, optionKey ) → to get the list value of an option key inside a section

Testing

Use this command to run the tests

go test -v ./...
task test
make test

Coverage

  • create a coverage folder
  • Use this command to see the coverage
mkdir coverage
go test -v ./... -coverprofile=coverage/coverage.out
go tool cover -html=coverage/coverage.out -o coverage/coverage.html
task coverage
make coverage
  • Open coverage/coverage.html to trace the coverage

Benchmarks

Use this command to run the tests

go test -v ./... -bench=. -count 1 -benchtime=10s -benchmem -run=^#
make benchmarks
task benchmarks

dmidecode's People

Contributors

rawdagastan avatar

Watchers

 avatar

dmidecode's Issues

dmidecode

Create a decoder for the output of dmidecode

Functions

Decode()
GetSections List all sections of the dmidecode output as a list
GetSection(sectionKey) decode a section into a map {key1:[val1] key2:[val2]}
GetOptions(sectionKey) List all options of a given sectionKey of the dmidecode output as a list
Get(sectionKey, optionKey) gets the value of optionKey in a section sectionKey
GetList(sectionKey, optionKey) gets the value of key key in a section sectionKey

Tests

  • Github actions
  • API tests

Notes

  • There is a special case for System Power Controls section

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.