diff --git a/README.md b/README.md index 643f26f..196d1dd 100644 --- a/README.md +++ b/README.md @@ -95,7 +95,7 @@ Commands: init Initialize a new empty jsonnetfile - install [...] + install [...] Install all dependencies or install specific ones update diff --git a/cmd/jb/install.go b/cmd/jb/install.go index a973af6..78b5d64 100644 --- a/cmd/jb/install.go +++ b/cmd/jb/install.go @@ -27,7 +27,7 @@ import ( "gopkg.in/alecthomas/kingpin.v2" ) -func installCommand(dir, jsonnetHome string, paths ...string) int { +func installCommand(dir, jsonnetHome string, uris ...string) int { if dir == "" { dir = "." } @@ -44,11 +44,11 @@ func installCommand(dir, jsonnetHome string, paths ...string) int { return 1 } - if len(paths) > 0 { - for _, path := range paths { - newDep := parseDependency(dir, path) + if len(uris) > 0 { + for _, uri := range uris { + newDep := parseDependency(dir, uri) if newDep == nil { - kingpin.Errorf("ignoring unrecognized path: %s", path) + kingpin.Errorf("ignoring unrecognized uri: %s", uri) continue } diff --git a/cmd/jb/install_test.go b/cmd/jb/install_test.go index e3a359f..ae3a78b 100644 --- a/cmd/jb/install_test.go +++ b/cmd/jb/install_test.go @@ -29,7 +29,7 @@ import ( func TestInstallCommand(t *testing.T) { testcases := []struct { Name string - URLs []string + URIs []string ExpectedCode int ExpectedJsonnetFile []byte ExpectedJsonnetLockFile []byte @@ -41,13 +41,13 @@ func TestInstallCommand(t *testing.T) { ExpectedJsonnetLockFile: []byte(`{"dependencies":null}`), }, { Name: "OneURL", - URLs: []string{"github.com/jsonnet-bundler/jsonnet-bundler@v0.1.0"}, + URIs: []string{"github.com/jsonnet-bundler/jsonnet-bundler@v0.1.0"}, ExpectedCode: 0, ExpectedJsonnetFile: []byte(`{"dependencies": [{"name": "jsonnet-bundler", "source": {"git": {"remote": "https://github.com/jsonnet-bundler/jsonnet-bundler", "subdir": ""}}, "version": "v0.1.0"}]}`), ExpectedJsonnetLockFile: []byte(`{"dependencies": [{"name": "jsonnet-bundler", "source": {"git": {"remote": "https://github.com/jsonnet-bundler/jsonnet-bundler", "subdir": ""}}, "version": "080f157c7fb85ad0281ea78f6c641eaa570a582f"}]}`), }, { Name: "Relative", - URLs: []string{"test/jsonnet/foobar"}, + URIs: []string{"test/jsonnet/foobar"}, ExpectedCode: 0, ExpectedJsonnetFile: []byte(`{"dependencies": [{"name": "foobar", "source": {"local": {"directory": "test/jsonnet/foobar"}}, "version": ""}]}`), ExpectedJsonnetLockFile: []byte(`{"dependencies": [{"name": "foobar", "source": {"local": {"directory": "test/jsonnet/foobar"}}, "version": ""}]}`), @@ -71,7 +71,7 @@ func TestInstallCommand(t *testing.T) { jsonnetFileContent(t, jsonnetFile, []byte(`{}`)) - code = installCommand(tempDir, "vendor", tc.URLs...) + code = installCommand(tempDir, "vendor", tc.URIs...) assert.Equal(t, tc.ExpectedCode, code) jsonnetFileContent(t, jsonnetFile, tc.ExpectedJsonnetFile) diff --git a/cmd/jb/main.go b/cmd/jb/main.go index 67366ec..221a56e 100644 --- a/cmd/jb/main.go +++ b/cmd/jb/main.go @@ -63,7 +63,7 @@ func Main() int { initCmd := a.Command(initActionName, "Initialize a new empty jsonnetfile") installCmd := a.Command(installActionName, "Install all dependencies or install specific ones") - installCmdPaths := installCmd.Arg("paths", "paths to packages to install, URLs or file paths").Strings() + installCmdURIs := installCmd.Arg("uris", "URIs to packages to install, URLs or file paths").Strings() updateCmd := a.Command(updateActionName, "Update all dependencies.") @@ -83,7 +83,7 @@ func Main() int { case initCmd.FullCommand(): return initCommand(workdir) case installCmd.FullCommand(): - return installCommand(workdir, cfg.JsonnetHome, *installCmdPaths...) + return installCommand(workdir, cfg.JsonnetHome, *installCmdURIs...) case updateCmd.FullCommand(): return updateCommand(cfg.JsonnetHome) default: @@ -93,16 +93,16 @@ func Main() int { return 0 } -func parseDependency(dir, path string) *spec.Dependency { - if d := parseGitSSHDependency(path); d != nil { +func parseDependency(dir, uri string) *spec.Dependency { + if d := parseGitSSHDependency(uri); d != nil { return d } - if d := parseGithubDependency(path); d != nil { + if d := parseGithubDependency(uri); d != nil { return d } - if d := parseLocalDependency(dir, path); d != nil { + if d := parseLocalDependency(dir, uri); d != nil { return d }