Skip to content

Commit

Permalink
Merge pull request #28 from derhnyel/main
Browse files Browse the repository at this point in the history
Fix df parsing
  • Loading branch information
deven96 authored Jan 7, 2023
2 parents 9955ac2 + 3fb1583 commit 566fc1a
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions inspector/disk.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,14 @@ func (i *DF) Parse(output string) {
log.Fatalf(`Error Parsing Percent Full: %s `, err)
}
// find size
for index := range columns {
_, err := strconv.ParseInt(columns[index], 0, 64)
originalColumns := columns
for index := range originalColumns {
_, err := strconv.ParseInt(originalColumns[index], 0, 64)
if err == nil {
columns[0] = strings.Join(columns[:index], " ")
columns[1] = columns[index]
columns[0] = strings.Join(originalColumns[:index], " ")
columns[1] = originalColumns[index]
columns[2] = originalColumns[index+1]
columns[3] = originalColumns[index+2]
break
}
}
Expand Down Expand Up @@ -138,7 +141,8 @@ type DFWin struct {
Values []DFMetrics
}

/* Parse : For the following windows output
/*
Parse : For the following windows output
Node,DeviceID,DriveType,FreeSpace,ProviderName,Size,VolumeName
IMANI,C:,3,191980253184,,288303964160,OS
Expand Down

0 comments on commit 566fc1a

Please sign in to comment.