diff options
author | Jon Bratseth <bratseth@gmail.com> | 2021-08-30 09:45:33 +0200 |
---|---|---|
committer | Jon Bratseth <bratseth@gmail.com> | 2021-08-30 09:45:33 +0200 |
commit | 0cb34bea93a4090af9eacb98529a3157dc89ece7 (patch) | |
tree | 63ebd8b2577a9a95b586c798b3990b8bffe54208 /client | |
parent | c3131b0641776e410a51f4d42d8b7a2faa3f82bf (diff) |
Rename init to clone and switch argument order
Diffstat (limited to 'client')
-rw-r--r-- | client/go/cmd/clone.go (renamed from client/go/cmd/init.go) | 16 | ||||
-rw-r--r-- | client/go/cmd/clone_test.go (renamed from client/go/cmd/init_test.go) | 8 |
2 files changed, 12 insertions, 12 deletions
diff --git a/client/go/cmd/init.go b/client/go/cmd/clone.go index 8cbaf163336..cdfbcb24dad 100644 --- a/client/go/cmd/init.go +++ b/client/go/cmd/clone.go @@ -1,5 +1,5 @@ // Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -// vespa init command +// vespa clone command // author: bratseth package cmd @@ -26,26 +26,26 @@ var existingSampleAppsZip string func init() { existingSampleAppsZip = "" - rootCmd.AddCommand(initCmd) + rootCmd.AddCommand(cloneCmd) } -var initCmd = &cobra.Command{ +var cloneCmd = &cobra.Command{ // TODO: "application" and "list" subcommands? - Use: "init", + Use: "clone", Short: "Creates the files and directory structure for a new Vespa application", - Long: `TODO: vespa init applicationName source`, + Long: `TODO: vespa clone source applicationName`, Args: func(cmd *cobra.Command, args []string) error { if len(args) != 2 { - return errors.New("vespa init requires a project name and source") + return errors.New("vespa clone requires an application source and name") } return nil }, Run: func(cmd *cobra.Command, args []string) { - initApplication(args[0], args[1]) + cloneApplication(args[0], args[1]) }, } -func initApplication(name string, source string) { +func cloneApplication(source string, name string) { zipFile := getSampleAppsZip() if zipFile == nil { return diff --git a/client/go/cmd/init_test.go b/client/go/cmd/clone_test.go index 8bca3c96fb7..a98fed694fe 100644 --- a/client/go/cmd/init_test.go +++ b/client/go/cmd/clone_test.go @@ -13,13 +13,13 @@ import ( "github.com/vespa-engine/vespa/util" ) -func TestInit(t *testing.T) { - assertCreated("mytestapp", "album-recommendation-selfhosted", t) +func TestClone(t *testing.T) { + assertCreated("album-recommendation-selfhosted", "mytestapp", t) } -func assertCreated(app string, sampleAppName string, t *testing.T) { +func assertCreated(sampleAppName string, app string, t *testing.T) { existingSampleAppsZip = "testdata/sample-apps-master.zip" - standardOut := executeCommand(t, &mockHttpClient{}, []string{"init", app, sampleAppName}, []string{}) + standardOut := executeCommand(t, &mockHttpClient{}, []string{"clone", sampleAppName, app}, []string{}) defer os.RemoveAll(app) assert.Equal(t, "Created "+app+"\n", standardOut) assert.True(t, util.PathExists(filepath.Join(app, "README.md"))) |