Esempio n. 1
0
File: main.go Progetto: NeilW/rkt
func getValidArgs() (string, []string) {
	filename := ""
	mapTo := []string{}
	mapToWrapper := common.StringSliceWrapper{
		Slice: &mapTo,
	}

	flag.StringVar(&filename, "filelist", "", "Name of the source (path to the directory or to the filelist")
	flag.Var(&mapToWrapper, "map-to", "Map contents of traversed source to this directory, can be used multiple times")

	flag.Parse()
	if filename == "" {
		common.Die("No --filelist parameter passed")
	}
	if len(mapTo) < 1 {
		common.Die("No --map-to parameter passed, at least one is required")
		os.Exit(1)
	}

	filename = common.MustAbs(filename)
	for i := 0; i < len(mapTo); i++ {
		mapTo[i] = common.MustAbs(mapTo[i])
	}
	return filename, mapTo
}
Esempio n. 2
0
File: main.go Progetto: matomesc/rkt
func getDeepListing(dir string) *filelist.Lists {
	walker := newFsWalker(common.MustAbs(dir))
	list, err := walker.getListing()
	if err != nil {
		common.Die("Error during getting listing from directory %q: %v", dir, err)
	}
	return list
}