示例#1
0
文件: upload.go 项目: vosst/csi
func actionUpload(c *cli.Context) {
	mi, err := machine.DefaultIdentifier()

	if err != nil {
		fmt.Fprintf(os.Stderr, "Could not create default machine identifier")
		return
	}

	u, err := url.Parse(c.String(uploadFlagDest.Name))
	if err != nil {
		fmt.Fprintf(os.Stderr, "Destination needs to be a valid url")
		return
	}

	crashDir := c.String(uploadFlagCrashDir.Name)
	persister := crash.HttpReportPersister{*u, mi, &http.Client{}}

	crash.ForEachReportInDir(crashDir, UploadingVisitor{crashDir, os.Stdout, persister, c.Bool(uploadFlagCleanup.Name)})
}
示例#2
0
文件: list.go 项目: vosst/csi
func actionList(c *cli.Context) {
	crashDir := c.String(listFlagCrashDir.Name)
	fmt.Fprintf(os.Stdout, "Listing crash reports in %s:\n", crashDir)
	crash.ForEachReportInDir(crashDir, ListingVisitor{os.Stdout})
}