ListAlias prints all configured aliases, or only those matching the configured alias filter.
()
| 49 | |
| 50 | // ListAlias prints all configured aliases, or only those matching the configured alias filter. |
| 51 | func (ac *AliasController) ListAlias() { |
| 52 | var aliasCount int |
| 53 | for _, server := range ac.configuration.ServerLists { |
| 54 | if ac.alias == "" { |
| 55 | if server.Alias != "" { |
| 56 | fmt.Printf("Alias: %s\tServer: %s\n", server.Alias, server.IP) |
| 57 | aliasCount++ |
| 58 | } |
| 59 | } else { |
| 60 | if server.Alias == ac.alias { |
| 61 | fmt.Printf("Alias: %s\tServer: %s\n", server.Alias, server.IP) |
| 62 | aliasCount++ |
| 63 | } |
| 64 | } |
| 65 | } |
| 66 | if aliasCount == 0 { |
| 67 | utils.Infoln("No aliases were found that have been set.") |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | // UnsetAlias removes the configured alias from all matching server entries. |
| 72 | func (ac *AliasController) UnsetAlias() bool { |