MCPcopy Create free account
hub / github.com/OpenAtomFoundation/SmartIDE / getGitUrlFromArgs

Function getGitUrlFromArgs

cli/cmd/common/workspace.go:639–655  ·  view source on GitHub ↗

获取参数gitUrl

(cmd *cobra.Command, args []string)

Source from the content-addressed store, hash-verified

637
638// 获取参数gitUrl
639func getGitUrlFromArgs(cmd *cobra.Command, args []string) string {
640 // 从args中获取值
641 var gitUrl string = ""
642 if len(args) > 0 { // 从args中加载
643 str := args[0]
644 if strings.Index(str, "git@") == 0 || strings.Index(str, "http://") == 0 || strings.Index(str, "https://") == 0 {
645 gitUrl = str
646 }
647 }
648
649 //
650 if gitUrl == "" {
651 gitUrl = getFlagValue(cmd.Flags(), flag_repourl)
652 }
653
654 return gitUrl
655}
656
657// 直接调用git命令进行git clone
658func cloneRepo4LocalWithCommand(rootDir string, actualGitRepoUrl string) (string, error) {

Callers 1

loadGitInfo4WorkspaceFunction · 0.85

Calls 1

getFlagValueFunction · 0.70

Tested by

no test coverage detected