sysinfo

package module
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: May 14, 2020 License: GPL-3.0 Imports: 10 Imported by: 2

README

sysinfo

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" -u gitlab.com/mjwhitta/sysinfo/cmd/sysinfo

Or install from source:

$ git clone https://gitlab.com/mjwhitta/sysinfo.git
$ cd sysinfo
$ make
$ cp ./build/linux/amd64/sysinfo ~/.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.1.1"

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) 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