pass through arguments from command line

This commit is contained in:
Dominic Breuker
2018-02-13 21:41:41 +01:00
parent 2ed0991b9c
commit 91381d10a0
6 changed files with 60 additions and 23 deletions

View File

@@ -15,7 +15,7 @@ func NewProcList() *ProcList {
return &pl
}
func (pl ProcList) Refresh() error {
func (pl ProcList) Refresh(print bool) error {
pids, err := getPIDs()
if err != nil {
return err
@@ -33,7 +33,9 @@ func (pl ProcList) Refresh() error {
if err != nil {
uid = "???"
}
log.Printf("\x1b[31;1mCMD: UID=%-4s PID=%-6d | %s\x1b[0m\n", uid, pid, cmd)
if print {
log.Printf("\x1b[31;1mCMD: UID=%-4s PID=%-6d | %s\x1b[0m\n", uid, pid, cmd)
}
pl[pid] = cmd
}
}