Skip to content
This repository has been archived by the owner on Apr 9, 2023. It is now read-only.
/ osinfo Public archive

osinfo library get HW / SW information for Linux/Mac/Unix.

License

Notifications You must be signed in to change notification settings

nao1215/osinfo

Repository files navigation

How to use

Sample code

package main

import (
	"fmt"

	"github.com/nao1215/osinfo"
)

func main() {
	osinfo := osinfo.Get()
	printAllInfo(osinfo)
}

func printAllInfo(info osinfo.OsInfo) {
	fmt.Println("OS                  : " + info.Os)
	fmt.Println("Distribution        : " + info.Distro)
	fmt.Println("Model(Host)         : " + info.Model)
	fmt.Println("Kenel name          : " + info.Kernel.Name)
	fmt.Println("Kernel version      : " + info.Kernel.Ver)
	fmt.Println("Kernel architecture : " + info.Kernel.Arch)
	fmt.Println("Uptime              : " + info.Uptime)
	fmt.Println("Shell               : " + info.Shell)
	fmt.Println("Mac name            : " + info.Mac.Name)
	fmt.Println("Mac version         : " + info.Mac.Ver)
	fmt.Println("Mac build version   : " + info.Mac.BuildVer)
}

Result

OS                  : Linux
Distribution        : Ubuntu Budgie 21.10
Model(Host)         : Gigabyte Technology Co., Ltd. B450 I AORUS PRO WIFI-CF
Kenel name          : Linux
Kernel version      : 5.13.0-22-generic
Kernel architecture : x86_64
Uptime              : 2 days, 9 hours, 54 minutes
Shell               : bash 5.1.8
Mac name            : This is not mac
Mac version         : No version information
Mac build version   : No build information

Why did I create the osinfo library

In order to implement the neofetch command in golang in another project (mimixbox), it was necessary to port the function of neofetch (written by shell) to golang.

Contact

If you would like to send comments such as "find a bug" or "request for additional features" to the developer, please use one of the following contacts.

LICENSE

The osinfo project is licensed under the terms of the Apache License 2.0.
See LICENSE.

About

osinfo library get HW / SW information for Linux/Mac/Unix.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages