(hosts []string, csvFile string, maxHosts int)
| 65 | } |
| 66 | |
| 67 | func parseCSV(hosts []string, csvFile string, maxHosts int) ([]string, error) { |
| 68 | f, err := os.Open(csvFile) |
| 69 | if err != nil { |
| 70 | return nil, err |
| 71 | } |
| 72 | defer f.Close() |
| 73 | |
| 74 | r := csv.NewReader(f) |
| 75 | for err == nil && len(hosts) < maxHosts { |
| 76 | var record []string |
| 77 | record, err = r.Read() |
| 78 | hosts = append(hosts, record[len(record)-1]) |
| 79 | } |
| 80 | if err == io.EOF { |
| 81 | err = nil |
| 82 | } |
| 83 | |
| 84 | return hosts, err |
| 85 | } |
| 86 | |
| 87 | func scanMain(args []string, c cli.Config) (err error) { |
| 88 | if c.List { |