Skip to content

Commit

Permalink
fix show commands bug
Browse files Browse the repository at this point in the history
  • Loading branch information
fr3h4g committed Oct 17, 2024
1 parent ae2b0a9 commit 6ce8265
Showing 1 changed file with 24 additions and 18 deletions.
42 changes: 24 additions & 18 deletions cmd/mjau/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -401,30 +401,36 @@ func RunRequest(cmd *cobra.Command, requestName string, config *Config) {
fmt.Println(string(body) + "\n")
}

if cmd.Flag("show-commands").Value.String() == "true" {
if len(request.Commands) > 0 {
if len(request.Commands) > 0 {
if cmd.Flag("show-commands").Value.String() == "true" {
fmt.Println("🔧 Commands:")
for _, command := range request.Commands {
}
for _, command := range request.Commands {
if cmd.Flag("show-commands").Value.String() == "true" {
fmt.Println(" ✨ " + command.Description)
if command.Command == "echo" {
}
if command.Command == "echo" {
if cmd.Flag("show-commands").Value.String() == "true" {
fmt.Println(" " + config.InsertVariables(command.Value))
}
if command.Command == "add_variable" {
config.StoreVariable(
command.Variable,
config.InsertVariables(command.Value),
)
}
if command.Command == "add_json_variable" {
value := GetJsonValueFromPath(
config.GetVariable(command.FromVariable),
command.Path,
)
if value != "" {
config.StoreVariable(command.Variable, value)
}
}
if command.Command == "add_variable" {
config.StoreVariable(
command.Variable,
config.InsertVariables(command.Value),
)
}
if command.Command == "add_json_variable" {
value := GetJsonValueFromPath(
config.GetVariable(command.FromVariable),
command.Path,
)
if value != "" {
config.StoreVariable(command.Variable, value)
}
}
}
if cmd.Flag("show-commands").Value.String() == "true" {
fmt.Println("")
}
}
Expand Down

0 comments on commit 6ce8265

Please sign in to comment.