@@ -36,7 +36,7 @@ func (c *CLI) GetInput() {
3636 }
3737
3838 for {
39- fmt .Println ("" )
39+ fmt .Println ()
4040 for index , opt := range options {
4141 fmt .Printf ("[%1d] %s\n " , index + 1 , opt .name )
4242 }
@@ -118,7 +118,7 @@ func (c *CLI) searchPosts() {
118118 }
119119
120120 if results := c .PublicationService .Search ("Publication" , userInput ); len (results ) > 0 {
121- fmt .Println ("" )
121+ fmt .Println ()
122122 fmt .Println ("Publications:" )
123123 for _ , res := range results {
124124 if pub , err := c .PublicationService .Find (res .ID ); err == nil {
@@ -135,7 +135,7 @@ func (c *CLI) searchPosts() {
135135 posts := c .PublicationService .GetPosts (ids )
136136 c .pagedList ("Posts" , posts , 0 , 10 )
137137 } else {
138- fmt .Println ("" )
138+ fmt .Println ()
139139 fmt .Println ("No Posts Found" )
140140 }
141141}
@@ -174,19 +174,25 @@ func (c *CLI) pagedList(title string, list []entities.Post, page int, size int)
174174
175175// viewPost allows users to view more details about a post
176176func (c * CLI ) viewPost (post entities.Post ) {
177- fmt .Println ("" )
177+ fmt .Println ()
178178 fmt .Println (post .Title )
179179 fmt .Println (post .URL )
180180 fmt .Printf ("Posted at %s" , post .CreatedAt .Format ("2006-01-02 03:04PM" ))
181- fmt .Println ("" )
181+ fmt .Println ()
182182
183183 if results := c .PublicationService .Search ("Post" , post .Title ); len (results ) > 1 {
184- fmt .Println ("" )
184+ ids := make ([]string , 0 )
185+ for _ , res := range results {
186+ ids = append (ids , res .ID )
187+ }
188+ posts := c .PublicationService .GetPosts (ids )
189+
190+ fmt .Println ()
185191 fmt .Println ("Similar Posts:" )
186- for _ , res := range results [1 :] {
187- fmt .Println ( & res )
192+ for index , post := range posts [1 :] {
193+ fmt .Printf ( "[%d] %s \n " , index , & post )
188194 }
189- fmt .Println ("" )
195+ fmt .Println ()
190196 }
191197}
192198
@@ -225,12 +231,12 @@ func (c *CLI) feedFetchWorker(id int, jobs <-chan entities.Publication, results
225231
226232// printBanner simply prints a silly ASCII banner
227233func (c * CLI ) printBanner () {
228- fmt .Println ("" )
234+ fmt .Println ()
229235 fmt .Println (" __ __ " )
230236 fmt .Println (" ___ ___ ____ _/ /____ _/ /_____ _" )
231237 fmt .Println (" / _ \\ / _ `/ _ `/ __/ _ `/ '_/ _ `/" )
232238 fmt .Println (" / .__/\\ _,_/\\ _,_/\\ __/\\ _,_/_/\\ _/\\ _,_/" )
233239 fmt .Println (" /_/" , c .PublicationService .GetRepositoryVersion ())
234240 fmt .Println (" https://github.com/janithl/paataka" )
235- fmt .Println ("" )
241+ fmt .Println ()
236242}
0 commit comments