improve message when no record matches
This commit is contained in:
parent
7a7e50bf34
commit
0a0c8474b8
8
main.go
8
main.go
@ -75,12 +75,16 @@ func selectRecordsToDelete(recs []libdns.Record) []libdns.Record {
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}()
|
}()
|
||||||
fmt.Printf("Records matching %s\n", name)
|
if len(recs) == 0 {
|
||||||
|
fmt.Printf("No Records match %s\n", name)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
fmt.Printf("Records matching %s\n\n", name)
|
||||||
for i, r := range recs {
|
for i, r := range recs {
|
||||||
fmt.Printf("%5d %6s %s\n", i, r.Type, r.Value)
|
fmt.Printf("%5d %6s %s\n", i, r.Type, r.Value)
|
||||||
}
|
}
|
||||||
var delRange string
|
var delRange string
|
||||||
fmt.Print("Enter record indexes seperated by comma(,) to delete. Use hyphen(-) for a closed range. Also can be all or none\nIndexes: ")
|
fmt.Print("\nEnter record indexes seperated by comma(,) to delete. Use hyphen(-) for a closed range. Also can be all or none\nIndexes: ")
|
||||||
if _, err := fmt.Scanln(&delRange); err != nil {
|
if _, err := fmt.Scanln(&delRange); err != nil {
|
||||||
log.Panicln(err)
|
log.Panicln(err)
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,14 @@ func TestParseRange(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestParseRangeEmpty(t *testing.T) {
|
||||||
|
expectedLen := 0
|
||||||
|
actual := parseRange("", 10)
|
||||||
|
if expectedLen != len(actual) {
|
||||||
|
t.Errorf("unexpected %#v\n", actual)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestParseIP(t *testing.T) {
|
func TestParseIP(t *testing.T) {
|
||||||
var ip net.IP
|
var ip net.IP
|
||||||
if err := ip.UnmarshalText([]byte("127.0.0.1")); err != nil {
|
if err := ip.UnmarshalText([]byte("127.0.0.1")); err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user