Skip to content

Commit

Permalink
Better message when no files to be listed in directory
Browse files Browse the repository at this point in the history
[finishes #63120324]

Signed-off-by: David Sabeti <dsabeti@pivotal.io>
  • Loading branch information
Simon Leung authored and dsabeti committed Dec 18, 2014
1 parent 3225fb2 commit bfcded2
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cf/commands/application/files.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,5 +94,10 @@ func (cmd *Files) Run(c *cli.Context) {

cmd.ui.Ok()
cmd.ui.Say("")
cmd.ui.Say("%s", list)

if list == "" {
cmd.ui.Say("No files found")
} else {
cmd.ui.Say("%s", list)
}
}
18 changes: 18 additions & 0 deletions cf/commands/application/files_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,5 +112,23 @@ var _ = Describe("files command", func() {

})

Context("when there is no file to be listed", func() {
BeforeEach(func() {
appFilesRepo.ListFilesReturns("", nil)
})

It("informs user that the directory is empty", func() {
runCommand("my-app", "/foo")

Expect(ui.Outputs).To(ContainSubstrings(
[]string{"Getting files for app", "my-found-app", "my-org", "my-space", "my-user"},
[]string{"OK"},
[]string{""},
[]string{"No files found"},
))
})

})

})
})

0 comments on commit bfcded2

Please sign in to comment.