hub/commands/submodule.go

38 строки
770 B
Go
Исходник Обычный вид История

2013-07-13 12:19:42 +04:00
package commands
var cmdSubmodule = &Command{
2013-07-20 10:00:45 +04:00
Run: submodule,
2013-07-13 12:19:42 +04:00
GitExtension: true,
Usage: "submodule add [-p] [<OPTIONS>] [<USER>/]<REPOSITORY> <DESTINATION>",
Long: `Add a git submodule for a GitHub repository.
## Examples:
$ hub submodule add jingweno/gh vendor/gh
> git submodule add git://github.com/jingweno/gh.git vendor/gh
2016-01-24 18:50:01 +03:00
## See also:
hub-remote(1), hub(1), git-submodule(1)
`,
2013-07-13 12:19:42 +04:00
}
func init() {
CmdRunner.Use(cmdSubmodule)
}
2013-07-13 12:19:42 +04:00
func submodule(command *Command, args *Args) {
if !args.IsParamsEmpty() {
transformSubmoduleArgs(args)
}
}
func transformSubmoduleArgs(args *Args) {
2013-12-17 04:35:51 +04:00
var idx int
if idx = args.IndexOfParam("add"); idx == -1 {
return
2013-07-13 12:19:42 +04:00
}
2013-12-17 04:35:51 +04:00
args.RemoveParam(idx)
transformCloneArgs(args)
2013-12-17 04:35:51 +04:00
args.InsertParam(idx, "add")
2013-07-13 12:19:42 +04:00
}