Skip to content
This repository has been archived by the owner on May 27, 2022. It is now read-only.

Commit

Permalink
Validation for no bundles passed
Browse files Browse the repository at this point in the history
fixes #55
  • Loading branch information
caarlos0 committed Aug 15, 2015
1 parent ff61d76 commit f601f51
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -24,3 +24,5 @@ _testmain.go
*.prof
bin/
*.tar.gz

coverage.out
6 changes: 5 additions & 1 deletion api.go
Expand Up @@ -46,7 +46,11 @@ func ProcessArgs(args []string, home string) {
case "update":
update(home)
case "bundle":
bundle(args[1], home)
if len(args) < 2 {
fmt.Println("bundle needs to receive an argument in 'user/repo' format")
} else {
bundle(args[1], home)
}
case "version":
fmt.Println(version)
default:
Expand Down
7 changes: 7 additions & 0 deletions api_test.go
Expand Up @@ -26,6 +26,13 @@ func TestProcessesArgsDoBundle(t *testing.T) {
assertBundledPlugins(t, 1, home)
}

func TestBundleWithNoBundles(t *testing.T) {
home := doubles.TempHome()
ProcessArgs([]string{"bundle", ""}, home)
ProcessArgs([]string{"bundle"}, home)
assertBundledPlugins(t, 0, home)
}

func TestUpdateWithNoPlugins(t *testing.T) {
home := doubles.TempHome()
ProcessArgs([]string{"update"}, home)
Expand Down

0 comments on commit f601f51

Please sign in to comment.