/* File for Process-related structs and methods */ package jsh import ( "errors" ) // Process is a struct for marshalling into JSON output for the ps utility. type Process struct { User string Pid string PercentCpu string PercentMem string Vsz string Rss string Tty string Stat string Start string Time string Command string } // NewProcess func NewProcess(args []string) (procPtr *Process, err error) { err = nil // 11 = number of fields in the Process struct if len(args) != 11 { procPtr = &Process{} err = errors.New("Unexpected number of columns") } else { // TODO: figure out nicer way to do this procPtr = &Process{ args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9], args[10]} } return }