diff --git a/README.md b/README.md index 7c15b28..29d574b 100644 --- a/README.md +++ b/README.md @@ -26,9 +26,9 @@ Current workflow categories are: [](https://trickest.io/auth/register) -# Store +# Library -[Trickest Store](https://trickest.io/dashboard/store) is a collection of public tools, Trickest scripts, and Trickest workflows available on the platform. More info can be found at [Trickest workflows repository](https://github.com/trickest/workflows) <- (Coming soon!) +[Trickest Library](https://trickest.io/dashboard/library) is a collection of public tools, Trickest scripts, and Trickest workflows available on the platform. More info can be found at [Trickest workflows repository](https://github.com/trickest/workflows) <- (Coming soon!) # Installation @@ -118,7 +118,7 @@ trickest execute --workflow --space --confi | Flag | Type | Default | Description | |------------------|---------|---------|---------------------------------------------------------------------------------------------------------------------------------------------| | --config | file | / | YAML file for run configuration | -| --workflow | string | / | Workflow from the Store to be executed | +| --workflow | string | / | Workflow from the Library to be executed | | --max | boolean | / | Use maximum number of machines for workflow execution | | --output | string | / | A comma-separated list of nodes whose outputs should be downloaded when the execution is finished | | --output-all | boolean | / | Download all outputs when the execution is finished | @@ -191,7 +191,7 @@ trickest output --workflow --space [--nodes --space [--nodes ](https://trickest.io/auth/register) diff --git a/cmd/create/create.go b/cmd/create/create.go index 832b997..0bc8039 100644 --- a/cmd/create/create.go +++ b/cmd/create/create.go @@ -169,7 +169,7 @@ func CreateWorkflow(name, description string, spaceID, projectID uuid.UUID, dele os.Exit(0) } - resp := request.Trickest.Post().Body(data).DoF("store/workflow/?vault=%s", util.GetVault()) + resp := request.Trickest.Post().Body(data).DoF("library/workflow/?vault=%s", util.GetVault()) if resp == nil { fmt.Println("Error: Couldn't create workflow.") os.Exit(0) diff --git a/cmd/delete/delete.go b/cmd/delete/delete.go index 4d435aa..0152b4c 100644 --- a/cmd/delete/delete.go +++ b/cmd/delete/delete.go @@ -87,7 +87,7 @@ func DeleteProject(id uuid.UUID) { } func deleteWorkflow(id uuid.UUID) { - resp := request.Trickest.Delete().DoF("store/workflow/%s/", id.String()) + resp := request.Trickest.Delete().DoF("workflow/%s/", id.String()) if resp == nil { fmt.Println("Couldn't delete workflow with ID: " + id.String()) os.Exit(0) diff --git a/cmd/execute/execute.go b/cmd/execute/execute.go index eef8f64..87bd0de 100644 --- a/cmd/execute/execute.go +++ b/cmd/execute/execute.go @@ -76,7 +76,7 @@ var ExecuteCmd = &cobra.Command{ // Executing from a file version = readWorkflowYAMLandCreateVersion(workflowYAML, newWorkflowName, path) } else { - // Executing an existing workflow or copying from store + // Executing an existing workflow or copying from library version = prepareForExec(path) } if version == nil { @@ -941,12 +941,12 @@ func prepareForExec(objectPath string) *types.WorkflowVersionDetailed { } } } else { - // Executing from store + // Executing from library wfName := pathSplit[len(pathSplit)-1] - storeWorkflows := list.GetWorkflows(uuid.Nil, uuid.Nil, wfName, true) - if storeWorkflows != nil && len(storeWorkflows) > 0 { - // Executing from store - for _, wf := range storeWorkflows { + libraryWorkflows := list.GetWorkflows(uuid.Nil, uuid.Nil, wfName, true) + if libraryWorkflows != nil && len(libraryWorkflows) > 0 { + // Executing from library + for _, wf := range libraryWorkflows { if strings.ToLower(wf.Name) == strings.ToLower(wfName) { if project == nil && createProject { projectName := util.ProjectName @@ -965,14 +965,14 @@ func prepareForExec(objectPath string) *types.WorkflowVersionDetailed { copyDestination += "/" + project.Name } copyDestination += "/" + newWorkflowName - fmt.Println("Copying " + wf.Name + " from the store to " + copyDestination) + fmt.Println("Copying " + wf.Name + " from the library to " + copyDestination) projID := uuid.Nil if project != nil { projID = project.ID } newWorkflowID := copyWorkflow(space.ID, projID, wf.ID) if newWorkflowID == uuid.Nil { - fmt.Println("Couldn't copy workflow from the store!") + fmt.Println("Couldn't copy workflow from the library!") os.Exit(0) } @@ -1032,9 +1032,9 @@ func prepareForExec(objectPath string) *types.WorkflowVersionDetailed { } tools := list.GetTools(math.MaxInt, "", wfName) if tools == nil || len(tools) == 0 { - fmt.Println("Couldn't find a workflow or tool named " + wfName + " in the store!") - fmt.Println("Use \"trickest store list\" to see all available workflows and tools, " + - "or search the store using \"trickest store search \"") + fmt.Println("Couldn't find a workflow or tool named " + wfName + " in the library!") + fmt.Println("Use \"trickest library list\" to see all available workflows and tools, " + + "or search the library using \"trickest library search \"") os.Exit(0) } _, _, primitiveNodes = readConfig(configFile, nil, &tools[0]) diff --git a/cmd/execute/helpers.go b/cmd/execute/helpers.go index e1da54d..4e65744 100644 --- a/cmd/execute/helpers.go +++ b/cmd/execute/helpers.go @@ -27,7 +27,7 @@ import ( ) func getSplitter() *types.Splitter { - resp := request.Trickest.Get().DoF("store/splitter/") + resp := request.Trickest.Get().DoF("library/splitter/") if resp == nil { fmt.Println("Error: Couldn't get splitter.") } @@ -61,7 +61,7 @@ func getScriptByName(name string) *types.Script { } func getScripts(pageSize int, search string, name string) []types.Script { - urlReq := "store/script/" + urlReq := "library/script/" if pageSize > 0 { urlReq = urlReq + "?page_size=" + strconv.Itoa(pageSize) } else { @@ -162,7 +162,7 @@ func createNewVersion(version *types.WorkflowVersionDetailed) *types.WorkflowVer os.Exit(0) } - resp := request.Trickest.Post().Body(data).DoF("store/workflow-version/") + resp := request.Trickest.Post().Body(data).DoF("library/workflow-version/") if resp == nil { fmt.Println("Error: Couldn't create version!") os.Exit(0) @@ -245,7 +245,7 @@ func uploadFile(filePath string) string { } func GetLatestWorkflowVersion(workflowID uuid.UUID) *types.WorkflowVersionDetailed { - resp := request.Trickest.Get().DoF("store/workflow-version/latest/?workflow=%s", workflowID) + resp := request.Trickest.Get().DoF("library/workflow-version/latest/?workflow=%s", workflowID) if resp == nil { fmt.Println("Error: Couldn't get latest workflow version!") os.Exit(0) @@ -280,7 +280,7 @@ func copyWorkflow(destinationSpaceID, destinationProjectID, workflowID uuid.UUID os.Exit(0) } - resp := request.Trickest.Post().Body(data).DoF("store/workflow/%s/copy/", workflowID) + resp := request.Trickest.Post().Body(data).DoF("library/workflow/%s/copy/", workflowID) if resp == nil { fmt.Println("Error: Couldn't copy workflow!") os.Exit(0) @@ -309,7 +309,7 @@ func updateWorkflow(workflow *types.Workflow, deleteProjectOnError bool) { os.Exit(0) } - resp := request.Trickest.Patch().Body(data).DoF("store/workflow/%s/", workflow.ID) + resp := request.Trickest.Patch().Body(data).DoF("library/workflow/%s/", workflow.ID) if resp == nil { fmt.Println("Error: Couldn't update workflow!") os.Exit(0) @@ -606,23 +606,23 @@ func getToolScriptOrSplitterFromYAMLNode(node types.WorkflowYAMLNode) (*types.To fmt.Println("Invalid node ID format: " + node.ID) os.Exit(0) } - storeName := strings.TrimSuffix(node.ID, "-"+idSplit[len(idSplit)-1]) + libraryName := strings.TrimSuffix(node.ID, "-"+idSplit[len(idSplit)-1]) if node.Script == nil { - tools := list.GetTools(1, "", storeName) + tools := list.GetTools(1, "", libraryName) if tools == nil || len(tools) == 0 { splitter = getSplitter() if splitter == nil { - fmt.Println("Couldn't find a tool named " + storeName + " in the store!") - fmt.Println("Use \"trickest store list\" to see all available workflows and tools, " + - "or search the store using \"trickest store search \"") + fmt.Println("Couldn't find a tool named " + libraryName + " in the library!") + fmt.Println("Use \"trickest library list\" to see all available workflows and tools, " + + "or search the library using \"trickest library search \"") os.Exit(0) } } else { tool = &tools[0] } } else { - script = getScriptByName(storeName) + script = getScriptByName(libraryName) if script == nil { os.Exit(0) } diff --git a/cmd/store/store.go b/cmd/library/library.go similarity index 56% rename from cmd/store/store.go rename to cmd/library/library.go index d9e6788..2f63eae 100644 --- a/cmd/store/store.go +++ b/cmd/library/library.go @@ -1,13 +1,13 @@ -package store +package library import ( "github.com/spf13/cobra" ) -// StoreCmd represents the store command -var StoreCmd = &cobra.Command{ - Use: "store", - Short: "Browse workflows and tools in the Trickest store", +// LibraryCmd represents the library command +var LibraryCmd = &cobra.Command{ + Use: "library", + Short: "Browse workflows and tools in the Trickest library", Long: ``, Run: func(cmd *cobra.Command, args []string) { _ = cmd.Help() @@ -15,7 +15,7 @@ var StoreCmd = &cobra.Command{ } func init() { - StoreCmd.SetHelpFunc(func(command *cobra.Command, strings []string) { + LibraryCmd.SetHelpFunc(func(command *cobra.Command, strings []string) { _ = command.Flags().MarkHidden("space") _ = command.Flags().MarkHidden("project") _ = command.Flags().MarkHidden("workflow") diff --git a/cmd/library/libraryList.go b/cmd/library/libraryList.go new file mode 100644 index 0000000..4c5570f --- /dev/null +++ b/cmd/library/libraryList.go @@ -0,0 +1,19 @@ +package library + +import ( + "github.com/spf13/cobra" +) + +// libraryListCmd represents the libraryList command +var libraryListCmd = &cobra.Command{ + Use: "list", + Short: "List workflows and tools from the Trickest library", + Long: ``, + Run: func(cmd *cobra.Command, args []string) { + _ = cmd.Help() + }, +} + +func init() { + LibraryCmd.AddCommand(libraryListCmd) +} diff --git a/cmd/store/storeListTools.go b/cmd/library/libraryListTools.go similarity index 72% rename from cmd/store/storeListTools.go rename to cmd/library/libraryListTools.go index 4461bd9..0074a0c 100644 --- a/cmd/store/storeListTools.go +++ b/cmd/library/libraryListTools.go @@ -1,4 +1,4 @@ -package store +package library import ( "fmt" @@ -11,23 +11,23 @@ import ( "github.com/xlab/treeprint" ) -// storeListToolsCmd represents the storeListTools command -var storeListToolsCmd = &cobra.Command{ +// libraryListToolsCmd represents the libraryListTools command +var libraryListToolsCmd = &cobra.Command{ Use: "tools", - Short: "List tools from the Trickest store", + Short: "List tools from the Trickest library", Long: ``, Run: func(cmd *cobra.Command, args []string) { tools := list.GetTools(math.MaxInt, "", "") if len(tools) > 0 { printTools(tools) } else { - fmt.Println("Couldn't find any tool in the store!") + fmt.Println("Couldn't find any tool in the library!") } }, } func init() { - storeListCmd.AddCommand(storeListToolsCmd) + libraryListCmd.AddCommand(libraryListToolsCmd) } func printTools(tools []types.Tool) { diff --git a/cmd/store/storeListWorkflows.go b/cmd/library/libraryListWorkflows.go similarity index 73% rename from cmd/store/storeListWorkflows.go rename to cmd/library/libraryListWorkflows.go index 093f7ab..ff1d6b6 100644 --- a/cmd/store/storeListWorkflows.go +++ b/cmd/library/libraryListWorkflows.go @@ -1,4 +1,4 @@ -package store +package library import ( "fmt" @@ -10,23 +10,23 @@ import ( "github.com/xlab/treeprint" ) -// storeListWorkflowsCmd represents the storeListWorkflows command -var storeListWorkflowsCmd = &cobra.Command{ +// libraryListWorkflowsCmd represents the libraryListWorkflows command +var libraryListWorkflowsCmd = &cobra.Command{ Use: "workflows", - Short: "List workflows from the Trickest store", + Short: "List workflows from the Trickest library", Long: ``, Run: func(cmd *cobra.Command, args []string) { workflows := list.GetWorkflows(uuid.Nil, uuid.Nil, "", true) if len(workflows) > 0 { printWorkflows(workflows) } else { - fmt.Println("Couldn't find any workflow in the store!") + fmt.Println("Couldn't find any workflow in the library!") } }, } func init() { - storeListCmd.AddCommand(storeListWorkflowsCmd) + libraryListCmd.AddCommand(libraryListWorkflowsCmd) } func printWorkflows(workflows []types.WorkflowListResponse) { diff --git a/cmd/store/storeSearch.go b/cmd/library/librarySearch.go similarity index 58% rename from cmd/store/storeSearch.go rename to cmd/library/librarySearch.go index b8d561d..c26acfc 100644 --- a/cmd/store/storeSearch.go +++ b/cmd/library/librarySearch.go @@ -1,4 +1,4 @@ -package store +package library import ( "fmt" @@ -9,10 +9,10 @@ import ( "github.com/trickest/trickest-cli/cmd/list" ) -// storeSearchCmd represents the storeSearch command -var storeSearchCmd = &cobra.Command{ +// librarySearchCmd represents the librarySearch command +var librarySearchCmd = &cobra.Command{ Use: "search", - Short: "Search for workflows and tools in the Trickest store", + Short: "Search for workflows and tools in the Trickest library", Long: ``, Run: func(cmd *cobra.Command, args []string) { search := "" @@ -24,16 +24,16 @@ var storeSearchCmd = &cobra.Command{ if len(tools) > 0 { printTools(tools) } else { - fmt.Println("Couldn't find any tool in the store that matches the search!") + fmt.Println("Couldn't find any tool in the library that matches the search!") } if len(workflows) > 0 { printWorkflows(workflows) } else { - fmt.Println("Couldn't find any workflow in the store that matches the search!") + fmt.Println("Couldn't find any workflow in the library that matches the search!") } }, } func init() { - StoreCmd.AddCommand(storeSearchCmd) + LibraryCmd.AddCommand(librarySearchCmd) } diff --git a/cmd/list/list.go b/cmd/list/list.go index 5b2f74f..b79302c 100644 --- a/cmd/list/list.go +++ b/cmd/list/list.go @@ -221,10 +221,10 @@ func getSpaceByID(id uuid.UUID) *types.SpaceDetailed { return &space } -func GetWorkflows(projectID, spaceID uuid.UUID, search string, store bool) []types.WorkflowListResponse { - urlReq := "store/workflow/" +func GetWorkflows(projectID, spaceID uuid.UUID, search string, library bool) []types.WorkflowListResponse { + urlReq := "library/workflow/" urlReq += "?page_size=" + strconv.Itoa(math.MaxInt) - if !store { + if !library { urlReq += "&vault=" + util.GetVault().String() } @@ -259,7 +259,7 @@ func GetWorkflows(projectID, spaceID uuid.UUID, search string, store bool) []typ } func GetWorkflowByID(id uuid.UUID) *types.Workflow { - resp := request.Trickest.Get().DoF("store/workflow/%s/", id.String()) + resp := request.Trickest.Get().DoF("library/workflow/%s/", id.String()) if resp == nil { fmt.Println("Error: Couldn't get workflow by ID!") os.Exit(0) @@ -371,7 +371,7 @@ func ResolveObjectPath(path string, silent bool, isProject bool) (*types.SpaceDe } func GetTools(pageSize int, search string, name string) []types.Tool { - urlReq := "store/tool/" + urlReq := "library/tool/" if pageSize > 0 { urlReq = urlReq + "?page_size=" + strconv.Itoa(pageSize) } else { diff --git a/cmd/output/output.go b/cmd/output/output.go index 4b4b995..a4c7ab3 100644 --- a/cmd/output/output.go +++ b/cmd/output/output.go @@ -561,7 +561,7 @@ func GetRuns(workflowID uuid.UUID, pageSize int) []types.Run { } func GetWorkflowVersionByID(id uuid.UUID) *types.WorkflowVersionDetailed { - resp := request.Trickest.Get().DoF("store/workflow-version/%s/", id) + resp := request.Trickest.Get().DoF("library/workflow-version/%s/", id) if resp == nil { fmt.Println("Error: Couldn't get workflow version!") return nil diff --git a/cmd/root.go b/cmd/root.go index 36e7abd..ab336bd 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -7,9 +7,9 @@ import ( "github.com/trickest/trickest-cli/cmd/delete" "github.com/trickest/trickest-cli/cmd/execute" "github.com/trickest/trickest-cli/cmd/get" + "github.com/trickest/trickest-cli/cmd/library" "github.com/trickest/trickest-cli/cmd/list" "github.com/trickest/trickest-cli/cmd/output" - "github.com/trickest/trickest-cli/cmd/store" "github.com/trickest/trickest-cli/util" "github.com/spf13/cobra" @@ -43,7 +43,7 @@ func init() { cobra.OnInitialize(util.CreateRequest, initVaultID) RootCmd.AddCommand(list.ListCmd) - RootCmd.AddCommand(store.StoreCmd) + RootCmd.AddCommand(library.LibraryCmd) RootCmd.AddCommand(create.CreateCmd) RootCmd.AddCommand(delete.DeleteCmd) RootCmd.AddCommand(output.OutputCmd) diff --git a/cmd/store/storeList.go b/cmd/store/storeList.go deleted file mode 100644 index cb98bad..0000000 --- a/cmd/store/storeList.go +++ /dev/null @@ -1,19 +0,0 @@ -package store - -import ( - "github.com/spf13/cobra" -) - -// storeListCmd represents the storeList command -var storeListCmd = &cobra.Command{ - Use: "list", - Short: "List workflows and tools from the Trickest store", - Long: ``, - Run: func(cmd *cobra.Command, args []string) { - _ = cmd.Help() - }, -} - -func init() { - StoreCmd.AddCommand(storeListCmd) -}