当前位置: 首页>>代码示例>>Golang>>正文


Golang subprocess.SimpleExec函数代码示例

本文整理汇总了Golang中github.com/github/git-lfs/subprocess.SimpleExec函数的典型用法代码示例。如果您正苦于以下问题:Golang SimpleExec函数的具体用法?Golang SimpleExec怎么用?Golang SimpleExec使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了SimpleExec函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: LsRemote

func LsRemote(remote, remoteRef string) (string, error) {
	if remote == "" {
		return "", errors.New("remote required")
	}
	if remoteRef == "" {
		return subprocess.SimpleExec("git", "ls-remote", remote)

	}
	return subprocess.SimpleExec("git", "ls-remote", remote, remoteRef)
}
开发者ID:strich,项目名称:git-lfs,代码行数:10,代码来源:git.go

示例2: UnsetLocalKey

// UnsetLocalKey removes the git config value for the key from the specified config file
func (c *gitConfig) UnsetLocalKey(file, key string) {
	args := make([]string, 1, 5)
	args[0] = "config"
	if len(file) > 0 {
		args = append(args, "--file", file)
	}
	args = append(args, "--unset", key)
	subprocess.SimpleExec("git", args...)
}
开发者ID:strich,项目名称:git-lfs,代码行数:10,代码来源:git.go

示例3: SetLocal

// SetLocal sets the git config value for the key in the specified config file
func (c *gitConfig) SetLocal(file, key, val string) (string, error) {
	args := make([]string, 1, 5)
	args[0] = "config"
	if len(file) > 0 {
		args = append(args, "--file", file)
	}
	args = append(args, key, val)
	return subprocess.SimpleExec("git", args...)
}
开发者ID:zhaohaiyi,项目名称:git-lfs,代码行数:10,代码来源:git.go

示例4: Version

// Version returns the git version
func (c *gitConfig) Version() (string, error) {
	c.mu.Lock()
	defer c.mu.Unlock()

	if len(c.gitVersion) == 0 {
		v, err := subprocess.SimpleExec("git", "version")
		if err != nil {
			return v, err
		}
		c.gitVersion = v
	}

	return c.gitVersion, nil
}
开发者ID:zhaohaiyi,项目名称:git-lfs,代码行数:15,代码来源:git.go

示例5: ResolveRef

func ResolveRef(ref string) (*Ref, error) {
	outp, err := subprocess.SimpleExec("git", "rev-parse", ref, "--symbolic-full-name", ref)
	if err != nil {
		return nil, err
	}
	lines := strings.Split(outp, "\n")
	if len(lines) <= 1 {
		return nil, fmt.Errorf("Git can't resolve ref: %q", ref)
	}

	fullref := &Ref{Sha: lines[0]}
	fullref.Type, fullref.Name = ParseRefToTypeAndName(lines[1])
	return fullref, nil
}
开发者ID:strich,项目名称:git-lfs,代码行数:14,代码来源:git.go

示例6: ResolveRef

func ResolveRef(ref string) (*Ref, error) {
	outp, err := subprocess.SimpleExec("git", "rev-parse", ref, "--symbolic-full-name", ref)
	if err != nil {
		return nil, fmt.Errorf("Git can't resolve ref: %q", ref)
	}
	if outp == "" {
		return nil, fmt.Errorf("Git can't resolve ref: %q", ref)
	}

	lines := strings.Split(outp, "\n")
	fullref := &Ref{Sha: lines[0]}

	if len(lines) == 1 {
		// ref is a sha1 and has no symbolic-full-name
		fullref.Name = lines[0] // fullref.Sha
		fullref.Type = RefTypeOther
		return fullref, nil
	}

	// parse the symbolic-full-name
	fullref.Type, fullref.Name = ParseRefToTypeAndName(lines[1])
	return fullref, nil
}
开发者ID:zhaohaiyi,项目名称:git-lfs,代码行数:23,代码来源:git.go

示例7: List

// List lists all of the git config values
func (c *gitConfig) List() (string, error) {
	return subprocess.SimpleExec("git", "config", "-l")
}
开发者ID:strich,项目名称:git-lfs,代码行数:4,代码来源:git.go

示例8: UnsetGlobalSection

func (c *gitConfig) UnsetGlobalSection(key string) {
	subprocess.SimpleExec("git", "config", "--global", "--remove-section", key)
}
开发者ID:strich,项目名称:git-lfs,代码行数:3,代码来源:git.go

示例9: UnsetGlobal

// UnsetGlobal removes the git config value for the key from the global config
func (c *gitConfig) UnsetGlobal(key string) {
	subprocess.SimpleExec("git", "config", "--global", "--unset", key)
}
开发者ID:strich,项目名称:git-lfs,代码行数:4,代码来源:git.go

示例10: SetGlobal

// SetGlobal sets the git config value for the key in the global config
func (c *gitConfig) SetGlobal(key, val string) {
	subprocess.SimpleExec("git", "config", "--global", key, val)
}
开发者ID:strich,项目名称:git-lfs,代码行数:4,代码来源:git.go

示例11: SetGlobal

// SetGlobal sets the git config value for the key in the global config
func (c *gitConfig) SetGlobal(key, val string) (string, error) {
	return subprocess.SimpleExec("git", "config", "--global", key, val)
}
开发者ID:zhaohaiyi,项目名称:git-lfs,代码行数:4,代码来源:git.go

示例12: UnsetSystemSection

// UnsetGlobalSection removes the entire named section from the system config
func (c *gitConfig) UnsetSystemSection(key string) (string, error) {
	return subprocess.SimpleExec("git", "config", "--system", "--remove-section", key)
}
开发者ID:zhaohaiyi,项目名称:git-lfs,代码行数:4,代码来源:git.go

示例13: UnsetSystem

// UnsetSystem removes the git config value for the key from the system config
func (c *gitConfig) UnsetSystem(key string) (string, error) {
	return subprocess.SimpleExec("git", "config", "--system", "--unset", key)
}
开发者ID:zhaohaiyi,项目名称:git-lfs,代码行数:4,代码来源:git.go

示例14: UnsetGlobal

// UnsetGlobal removes the git config value for the key from the global config
func (c *gitConfig) UnsetGlobal(key string) (string, error) {
	return subprocess.SimpleExec("git", "config", "--global", "--unset", key)
}
开发者ID:zhaohaiyi,项目名称:git-lfs,代码行数:4,代码来源:git.go

示例15: SetSystem

// SetSystem sets the git config value for the key in the system config
func (c *gitConfig) SetSystem(key, val string) (string, error) {
	return subprocess.SimpleExec("git", "config", "--system", key, val)
}
开发者ID:zhaohaiyi,项目名称:git-lfs,代码行数:4,代码来源:git.go


注:本文中的github.com/github/git-lfs/subprocess.SimpleExec函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。