sysinfo

package module
v1.4.8 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2022 License: GPL-3.0 Imports: 11 Imported by: 2

README

sysinfo

🍪 Buy me a cookie

Go Report Card

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 gitlab.com/mjwhitta/sysinfo
$ go install --ldflags "-s -w" --trimpath \
    gitlab.com/mjwhitta/sysinfo/cmd/sysinfo@latest

Or install from source:

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

Note: make install will install to $HOME/.local/bin.

How to use

$ sysinfo
package main

import (
    "fmt"

    "gitlab.com/mjwhitta/sysinfo"
)

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

Configuration

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

{
  "kbg": "on_default",
  "kfg": "blue",
  "vbg": "on_default",
  "vfg": "green"
}

These values can be changed to adjust the key/value bg/fg colors.

TODO

  • Better README.md

Documentation

Index

Constants

View Source
const Version = "1.4.8"

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 added in v1.1.2

func (s *SysInfo) Clear()

Clear will remove all system info.

func (*SysInfo) Collect added in v1.1.2

func (s *SysInfo) Collect()

Collect will get requested system info.

func (*SysInfo) SetDataColors added in v1.0.24

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

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

func (*SysInfo) SetFieldColors added in v1.0.24

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

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

func (*SysInfo) String added in v1.0.1

func (s *SysInfo) String() string

String will convert the SysInfo struct to a printable string.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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