sysinfo

package module
v1.5.6 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: GPL-3.0 Imports: 12 Imported by: 3

README

sysinfo

Yum

Go Report Card License

What is this?

Provides system info for use by other tools.

How to install

Open a terminal and run the following:

$ go get --ldflags "-s -w" --trimpath -u github.com/mjwhitta/sysinfo
$ go install --ldflags "-s -w" --trimpath \
    github.com/mjwhitta/sysinfo/cmd/sysinfo@latest

Or compile from source:

$ git clone https://github.com/mjwhitta/sysinfo.git
$ cd sysinfo
$ git submodule update --init
$ make

How to use

$ sysinfo
package main

import (
    "fmt"

    "github.com/mjwhitta/sysinfo"
)

func main() {
    fmt.Println(sysinfo.New())
}

Configuration

Configuration is stored in $HOME/.config/sysinfo/rc. The default config looks like:

{
  "dataColors": [
    "green"
  ],
  "fieldColors": [
    "blue"
  ]
}

These values can be adjusted to meet your needs.

TODO

  • Better README.md

Documentation

Index

Constants

View Source
const Version string = "1.5.6"

Version is the package version

Variables

This section is empty.

Functions

This section is empty.

Types

type SysInfo

type SysInfo struct {
	Colors string `json:"-"`
	CPU    string `json:"CPU,omitempty"`

	Height int    `json:"-"`
	HomeFS string `json:"HomeFS,omitempty"`
	Host   string `json:"Host,omitempty"`

	IPv4   []string `json:"IPv4,omitempty"`
	IPv6   []string `json:"IPv6,omitempty"`
	Kernel string   `json:"Kernel,omitempty"`

	OS     string `json:"OS,omitempty"`
	RAM    string `json:"RAM,omitempty"`
	RootFS string `json:"RootFS,omitempty"`
	Shell  string `json:"Shell,omitempty"`
	TTY    string `json:"TTY,omitempty"`
	Uptime string `json:"Uptime,omitempty"`
	Width  int    `json:"-"`
	// contains filtered or unexported fields
}

SysInfo is a struct containing relevant system information.

func New

func New(fields ...string) *SysInfo

New will return a SysInfo pointer. A list of fields can be supplied if all info is not wanted.

func (*SysInfo) Clear

func (s *SysInfo) Clear()

Clear will remove all system info.

func (*SysInfo) Collect

func (s *SysInfo) Collect()

Collect will get requested system info.

func (*SysInfo) SetDataColors

func (s *SysInfo) SetDataColors(colors ...string)

SetDataColors will set the color values for the field data. See github.com/mjwhitta/hilighter for valid colors.

func (*SysInfo) SetFieldColors

func (s *SysInfo) SetFieldColors(colors ...string)

SetFieldColors will set the color values for the field names. See github.com/mjwhitta/hilighter for valid colors.

func (*SysInfo) String

func (s *SysInfo) String() string

String will return a string representation of the SysInfo.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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