• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang subprocess.SimpleExec函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: ListFromFile

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


示例17: Version

// Version returns the git version
func (c *gitConfig) Version() (string, error) {
	return subprocess.SimpleExec("git", "version")
}
开发者ID:strich,项目名称:git-lfs,代码行数:4,代码来源:git.go


示例18: UpdateIndex

func UpdateIndex(file string) error {
	_, err := subprocess.SimpleExec("git", "update-index", "-q", "--refresh", file)
	return err
}
开发者ID:strich,项目名称:git-lfs,代码行数:4,代码来源:git.go


示例19: FindLocal

// Find returns the git config value for the key
func (c *gitConfig) FindLocal(val string) string {
	output, _ := subprocess.SimpleExec("git", "config", "--local", val)
	return output
}
开发者ID:strich,项目名称:git-lfs,代码行数:5,代码来源:git.go


示例20: FindSystem

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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang test.NewRepo函数代码示例发布时间:2022-05-23
下一篇:
Golang subprocess.ExecCommand函数代码示例发布时间:2022-05-23
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap