MCPcopy Create free account
hub / github.com/auth0/auth0-cli / computeQuickstartPathFromClientName

Function computeQuickstartPathFromClientName

internal/cli/quickstarts.go:204–228  ·  view source on GitHub ↗
(clientName string)

Source from the content-addressed store, hash-verified

202}
203
204func computeQuickstartPathFromClientName(clientName string) (quickstartPath string, pathExists bool, err error) {
205 currDir, err := os.Getwd()
206 if err != nil {
207 return "", false, err
208 }
209
210 re := regexp.MustCompile(`[^\w]+`)
211 friendlyName := re.ReplaceAllString(clientName, "-")
212 target := path.Join(currDir, friendlyName)
213
214 pathExists = true
215 if _, err := os.Stat(target); err != nil {
216 if !os.IsNotExist(err) {
217 return "", false, err
218 }
219 pathExists = false
220 }
221
222 const readWriteAndExecutePermission = os.FileMode(0755)
223 if err := os.MkdirAll(target, readWriteAndExecutePermission); err != nil {
224 return "", false, err
225 }
226
227 return target, pathExists, nil
228}
229
230func quickstartsTypeFor(v string) string {
231 switch v {

Callers 1

downloadQuickstartFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected