获取参数gitUrl
(cmd *cobra.Command, args []string)
| 637 | |
| 638 | // 获取参数gitUrl |
| 639 | func 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 |
| 658 | func cloneRepo4LocalWithCommand(rootDir string, actualGitRepoUrl string) (string, error) { |
no test coverage detected