Skip to content

Commit

Permalink
fixed setting ignore dirs when showing devices
Browse files Browse the repository at this point in the history
  • Loading branch information
dundee committed Jan 29, 2021
1 parent 35fa215 commit fc02b77
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 4 deletions.
1 change: 1 addition & 0 deletions cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ func Run(flags *RunFlags, args []string, istty bool, writer io.Writer, testing b

if flags.ShowDisks {
if runtime.GOOS == "linux" {
ui.SetIgnoreDirPaths(flags.IgnoreDirs)
ui.ListDevices(analyze.GetDevicesInfo)
} else {
fmt.Fprint(writer, "Listing devices is not yet supported for this platform")
Expand Down
4 changes: 0 additions & 4 deletions tui/tui.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,10 +315,6 @@ func (ui *UI) fileItemSelected(row, column int) {
func (ui *UI) deviceItemSelected(row, column int) {
selectedDevice := ui.table.GetCell(row, column).GetReference().(*analyze.Device)

if ui.ignoreDirPaths == nil {
ui.ignoreDirPaths = make(map[string]bool, 10)
}

for _, device := range ui.devices {
if device.Name != selectedDevice.Name && !strings.HasPrefix(selectedDevice.MountPoint, device.MountPoint) {
ui.ignoreDirPaths[device.MountPoint] = true
Expand Down
1 change: 1 addition & 0 deletions tui/tui_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ func TestSelectDevice(t *testing.T) {

ui := CreateUI(simScreen, true)
ui.analyzer = analyzeMock
ui.SetIgnoreDirPaths([]string{"/proc"})
ui.ListDevices(getDevicesInfoMock)

go func() {
Expand Down

0 comments on commit fc02b77

Please sign in to comment.