Skip to content

Commit 79e2c32

Browse files
committed
omit unhelpful results
1 parent 764113b commit 79e2c32

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

cmd/list.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package cmd
33
import (
44
"context"
55
"os"
6+
"slices"
67

78
"github.com/spf13/cobra"
89

@@ -51,6 +52,12 @@ var listCmd = &cobra.Command{
5152

5253
spinner.Stop()
5354

55+
devices = slices.DeleteFunc(devices,
56+
func(d list.Device) bool {
57+
return d.Hostname == "N/A" && d.RemoteIP == nil
58+
},
59+
)
60+
5461
enc := encoder.New[list.Device](os.Stdout, output)
5562
if err := enc.Encode(devices...); err != nil {
5663
usage.Fatalf(cmd, "failed to encode devices: %s", err)

cmd/scan.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"net"
66
"os"
7+
"slices"
78

89
"github.com/spf13/cobra"
910

@@ -127,6 +128,12 @@ var scanCmd = &cobra.Command{
127128

128129
spinner.Stop()
129130

131+
scans = slices.DeleteFunc(scans,
132+
func(s scanner.Scan) bool {
133+
return s.Host == "N/A" && len(s.Ports) == 0
134+
},
135+
)
136+
130137
enc := encoder.New[scanner.Scan](os.Stdout, output)
131138
if err := enc.Encode(scans...); err != nil {
132139
usage.Fatalf(cmd, "failed to encode devices: %s", err)

0 commit comments

Comments
 (0)