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