本文整理匯總了Golang中v/io/jiri.X.JiriManifestFile方法的典型用法代碼示例。如果您正苦於以下問題:Golang X.JiriManifestFile方法的具體用法?Golang X.JiriManifestFile怎麽用?Golang X.JiriManifestFile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類v/io/jiri.X
的用法示例。
在下文中一共展示了X.JiriManifestFile方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: runImport
func runImport(jirix *jiri.X, args []string) error {
if len(args) != 2 {
return jirix.UsageErrorf("wrong number of arguments")
}
// Initialize manifest.
var manifest *project.Manifest
if !flagImportOverwrite {
m, err := project.ManifestFromFile(jirix, jirix.JiriManifestFile())
if err != nil && !runutil.IsNotExist(err) {
return err
}
manifest = m
}
if manifest == nil {
manifest = &project.Manifest{}
}
// There's not much error checking when writing the .jiri_manifest file;
// errors will be reported when "jiri update" is run.
manifest.Imports = append(manifest.Imports, project.Import{
Manifest: args[0],
Name: flagImportName,
Protocol: flagImportProtocol,
Remote: args[1],
RemoteBranch: flagImportRemoteBranch,
Root: flagImportRoot,
})
// Write output to stdout or file.
outFile := flagImportOut
if outFile == "" {
outFile = jirix.JiriManifestFile()
}
if outFile == "-" {
bytes, err := manifest.ToBytes()
if err != nil {
return err
}
_, err = os.Stdout.Write(bytes)
return err
}
return manifest.ToFile(jirix, outFile)
}