Exit with failure if aptly package search yields no results. #188

This commit is contained in:
Andrey Smirnov
2015-02-07 23:33:44 +03:00
parent fb03a3baf9
commit 7925af9fd6
3 changed files with 6 additions and 0 deletions

View File

@@ -21,6 +21,10 @@ func aptlyPackageSearch(cmd *commander.Command, args []string) error {
}
result := q.Query(context.CollectionFactory().PackageCollection())
if result.Len() == 0 {
return fmt.Errorf("no results")
}
result.ForEach(func(p *deb.Package) error {
context.Progress().Printf("%s\n", p)
return nil

View File

@@ -0,0 +1 @@
ERROR: no results

View File

@@ -15,6 +15,7 @@ class SearchPackage2Test(BaseTest):
search package: missing package
"""
runCmd = "aptly package search 'Name (package-xx)'"
expectedCode = 1
class SearchPackage3Test(BaseTest):