-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
upgraded dependencies; reorganized commands to add more
explain
com…
…mands
- Loading branch information
Showing
11 changed files
with
152 additions
and
163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
Copyright © 2023 NAME HERE <EMAIL ADDRESS> | ||
*/ | ||
|
||
package threagile | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/spf13/cobra" | ||
|
||
"github.com/threagile/threagile/pkg/common" | ||
"github.com/threagile/threagile/pkg/macros" | ||
"github.com/threagile/threagile/pkg/model" | ||
) | ||
|
||
func (what *Threagile) initExecute() *Threagile { | ||
what.rootCmd.AddCommand(&cobra.Command{ | ||
Use: "execute-model-macro", | ||
Short: "Execute model macro", | ||
Args: cobra.ExactArgs(1), | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
cfg := what.readConfig(cmd, what.buildTimestamp) | ||
progressReporter := common.DefaultProgressReporter{Verbose: cfg.Verbose} | ||
|
||
r, err := model.ReadAndAnalyzeModel(*cfg, progressReporter) | ||
if err != nil { | ||
return fmt.Errorf("unable to read and analyze model: %v", err) | ||
} | ||
|
||
macrosId := args[0] | ||
err = macros.ExecuteModelMacro(r.ModelInput, cfg.InputFile, r.ParsedModel, macrosId) | ||
if err != nil { | ||
return fmt.Errorf("unable to execute model macro: %v", err) | ||
} | ||
return nil | ||
}, | ||
}) | ||
|
||
return what | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.