template adjusment

This commit is contained in:
luke-hagar-sp
2023-06-26 14:19:42 -05:00
parent ad8b3ba84f
commit c14762459a
6 changed files with 19 additions and 18 deletions

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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 {

View File

@@ -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
}