MCPcopy Index your code
hub / github.com/coder/coder / prettyDirectoryPath

Function prettyDirectoryPath

cli/templatepush.go:523–535  ·  view source on GitHub ↗

prettyDirectoryPath returns a prettified path when inside the users home directory. Falls back to dir if the users home directory cannot discerned. This function calls filepath.Clean on the result.

(dir string)

Source from the content-addressed store, hash-verified

521// home directory. Falls back to dir if the users home directory cannot
522// discerned. This function calls filepath.Clean on the result.
523func prettyDirectoryPath(dir string) string {
524 dir = filepath.Clean(dir)
525 homeDir, err := os.UserHomeDir()
526 if err != nil {
527 return dir
528 }
529 prettyDir := dir
530 if strings.HasPrefix(prettyDir, homeDir) {
531 prettyDir = strings.TrimPrefix(prettyDir, homeDir)
532 prettyDir = "~" + prettyDir
533 }
534 return prettyDir
535}
536
537func handleMissingTemplateVariables(inv *serpent.Invocation, args createValidTemplateVersionArgs, failedVersionID uuid.UUID) (*codersdk.TemplateVersion, error) {
538 client := args.Client

Callers 1

uploadMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected