mirror of
https://github.com/LukeHagar/sailpoint-cli.git
synced 2025-12-06 04:21:15 +00:00
template adjusment
This commit is contained in:
@@ -3,7 +3,6 @@ package sdk
|
||||
|
||||
import (
|
||||
"embed"
|
||||
"os"
|
||||
|
||||
"github.com/sailpoint-oss/sailpoint-cli/internal/initialize"
|
||||
"github.com/spf13/cobra"
|
||||
@@ -30,10 +29,7 @@ func newGolangCmd() *cobra.Command {
|
||||
if len(args) > 0 {
|
||||
projName = args[0]
|
||||
} else {
|
||||
projName, err = os.Getwd()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
projName = "go-template"
|
||||
}
|
||||
|
||||
err = initialize.InitializeProject(goTemplateContents, goTemplateDirName, projName)
|
||||
|
||||
@@ -3,7 +3,6 @@ package sdk
|
||||
|
||||
import (
|
||||
"embed"
|
||||
"os"
|
||||
|
||||
"github.com/sailpoint-oss/sailpoint-cli/internal/initialize"
|
||||
"github.com/spf13/cobra"
|
||||
@@ -30,10 +29,7 @@ func newPowerShellCmd() *cobra.Command {
|
||||
if len(args) > 0 {
|
||||
projName = args[0]
|
||||
} else {
|
||||
projName, err = os.Getwd()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
projName = "powershell-template"
|
||||
}
|
||||
|
||||
err = initialize.InitializeProject(pwshTemplateContents, pwshTemplateDirName, projName)
|
||||
|
||||
@@ -3,7 +3,6 @@ package sdk
|
||||
|
||||
import (
|
||||
"embed"
|
||||
"os"
|
||||
|
||||
"github.com/sailpoint-oss/sailpoint-cli/internal/initialize"
|
||||
"github.com/spf13/cobra"
|
||||
@@ -30,10 +29,7 @@ func newTypescriptCmd() *cobra.Command {
|
||||
if len(args) > 0 {
|
||||
projName = args[0]
|
||||
} else {
|
||||
projName, err = os.Getwd()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
projName = "typescript-template"
|
||||
}
|
||||
|
||||
err = initialize.InitializeProject(tsTemplateContents, tsTemplateDirName, projName)
|
||||
|
||||
@@ -45,7 +45,12 @@ func newCollectCmd(term terminal.Terminal) *cobra.Command {
|
||||
mpb.WithWaitGroup(&wg))
|
||||
|
||||
for i, endpoint := range args {
|
||||
password := credentials[i]
|
||||
var password string
|
||||
|
||||
if len(credentials) >= i-1 {
|
||||
password = credentials[i]
|
||||
}
|
||||
|
||||
if password == "" {
|
||||
password, err = term.PromptPassword("Please enter the password for " + endpoint)
|
||||
if err != nil {
|
||||
|
||||
@@ -11,14 +11,18 @@ import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"text/template"
|
||||
|
||||
"github.com/charmbracelet/log"
|
||||
)
|
||||
|
||||
const packageJsonName = "package.json"
|
||||
const (
|
||||
packageJsonName = "package.json"
|
||||
)
|
||||
|
||||
func InitializeProject(templateContents embed.FS, templateDirName string, projName string) error {
|
||||
|
||||
if projName == "" {
|
||||
return errors.New("connector name cannot be empty")
|
||||
return errors.New("project name cannot be empty")
|
||||
|
||||
}
|
||||
|
||||
@@ -53,6 +57,10 @@ func InitializeProject(templateContents embed.FS, templateDirName string, projNa
|
||||
return err
|
||||
}
|
||||
|
||||
log.Debug("creating file", "fileName", fileName)
|
||||
|
||||
fileName = strings.TrimSuffix(fileName, ".file")
|
||||
|
||||
if err := createFile(fileName, data); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user