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 }
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 }