()
| 25 | } |
| 26 | |
| 27 | func TLETextFile() { |
| 28 | |
| 29 | fmt.Print("\n ENTER TEXT FILE PATH > ") |
| 30 | var path string |
| 31 | fmt.Scanln(&path) |
| 32 | file, err := os.Open(path) |
| 33 | |
| 34 | if err != nil { |
| 35 | fmt.Println(color.Ize(color.Red, " [!] INVALID TEXT FILE")) |
| 36 | } |
| 37 | |
| 38 | scanner := bufio.NewScanner(file) |
| 39 | scanner.Split(bufio.ScanLines) |
| 40 | var txtlines []string |
| 41 | var count int = 0 |
| 42 | |
| 43 | for scanner.Scan() { |
| 44 | txtlines = append(txtlines, scanner.Text()) |
| 45 | count += 1 |
| 46 | } |
| 47 | |
| 48 | file.Close() |
| 49 | |
| 50 | if (count < 2 || count > 3) { |
| 51 | fmt.Println(color.Ize(color.Red, " [!] INVALID TLE FORMAT")) |
| 52 | return |
| 53 | } |
| 54 | |
| 55 | output := TLE{} |
| 56 | |
| 57 | if (count == 3) { |
| 58 | var satelliteName string = txtlines[0] |
| 59 | output = ConstructTLE(satelliteName, txtlines[1], txtlines[2]) |
| 60 | } else { |
| 61 | output = ConstructTLE("UNSPECIFIED", txtlines[0], txtlines[1]) |
| 62 | } |
| 63 | |
| 64 | PrintTLE(output) |
| 65 | } |
| 66 | |
| 67 | func TLEPlainString(){ |
| 68 | scanner := bufio.NewScanner(os.Stdin) |
no test coverage detected