Skip to content

Commit

Permalink
feat: update script and docs update (#620)
Browse files Browse the repository at this point in the history
* feat: update script and docs update

* updated docs

* updated docs
  • Loading branch information
exu authored Dec 7, 2021
1 parent a8d10f2 commit 5572138
Show file tree
Hide file tree
Showing 6 changed files with 253 additions and 162 deletions.
1 change: 1 addition & 0 deletions cmd/kubectl-testkube/commands/scripts.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ func NewScriptsCmd() *cobra.Command {

cmd.AddCommand(scripts.NewAbortExecutionCmd())
cmd.AddCommand(scripts.NewListScriptsCmd())
cmd.AddCommand(scripts.NewGetScriptsCmd())
cmd.AddCommand(scripts.NewStartScriptCmd())
cmd.AddCommand(scripts.NewGetExecutionCmd())
cmd.AddCommand(scripts.NewWatchExecutionCmd())
Expand Down
34 changes: 34 additions & 0 deletions cmd/kubectl-testkube/commands/scripts/get_script.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package scripts

import (
"fmt"

"github.com/kubeshop/testkube/pkg/ui"
"github.com/spf13/cobra"
"gopkg.in/yaml.v2"
)

func NewGetScriptsCmd() *cobra.Command {
return &cobra.Command{
Use: "get",
Short: "Get script by name",
Long: `Getting script from given namespace - if no namespace given "testkube" namespace is used`,
Run: func(cmd *cobra.Command, args []string) {
ui.Logo()

if len(args) == 0 {
ui.Failf("script name is not specified")
}

name := args[0]
client, _ := GetClient(cmd)
script, err := client.GetScript(name)
ui.ExitOnError("getting script "+name, err)

out, err := yaml.Marshal(script)
ui.ExitOnError("getting yaml ", err)

fmt.Printf("%s\n", out)
},
}
}
Binary file added docs/img/script-create-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/script-create-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/script-create-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 5572138

Please sign in to comment.