From 3441af29d67b66a61c9ebd936a0e112f11519f88 Mon Sep 17 00:00:00 2001 From: Sina Siadat Date: Mon, 20 Jun 2016 17:49:18 +0430 Subject: [PATCH] Add support for comma-separated titles in prospect command. Example usage: clearbit prospect -title CEO,COO company.com clearbit prospect -title "CEO, COO" -title CTO company.com Closes #17 --- cmd/clearbit/prospect.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cmd/clearbit/prospect.go b/cmd/clearbit/prospect.go index 1c96921..5d7e12a 100644 --- a/cmd/clearbit/prospect.go +++ b/cmd/clearbit/prospect.go @@ -3,6 +3,7 @@ package main import ( "github.com/codegangsta/cli" "github.com/thoughtbot/clearbit" + "regexp" ) var prospectCommand = cli.Command{ @@ -27,9 +28,15 @@ func prospect(ctx *cli.Context) error { name = ctx.String("name") role = ctx.String("role") seniority = ctx.String("seniority") - titles = ctx.StringSlice("title") + titlesCSV = ctx.StringSlice("title") + titles []string + separator = regexp.MustCompile("\\s*,\\s*") ) + for _, title := range titlesCSV { + titles = append(titles, separator.Split(title, -1)...) + } + if domain == "" { return requiredArgError("Usage: clearbit prospect ") }