func main() { // Print version if *fVersion { fmt.Printf("CommPortal Web Scraper - Version %s\n", Version) return } username := os.Getenv("COMMPORTAL_USER") password := os.Getenv("COMMPORTAL_PASS") loginURL := os.Getenv("COMMPORTAL_URL") portal, err := commportal.New(username, password, loginURL) if err != nil { log.Fatal(err) } phones, err := portal.Phones() if err != nil { log.Fatal(err) } // print all extensions if all { printAll(phones) } arg := flag.Args() printPhone(strings.Join(arg, " "), phones) }
func (c Phone) phones() (commportal.Subscribers, error) { portal, err := commportal.New(c.Username, c.Password, c.URL) if err != nil { return nil, err } phones, err := portal.Phones() if err != nil { return nil, err } return phones, nil }