Add a -resources flag to cmd/ractool
diff --git a/cmd/ractool/data.go b/cmd/ractool/data.go
index 6dcf40b..e474312 100644
--- a/cmd/ractool/data.go
+++ b/cmd/ractool/data.go
@@ -81,4 +81,6 @@
the chunk size (in DSpace)
-indexlocation
the index location, "start" or "end" (default "start")
+-resources
+ comma-separated list of resource files, such as shared dictionaries
`
diff --git a/cmd/ractool/main.go b/cmd/ractool/main.go
index 51e88f2..9bf73bd 100644
--- a/cmd/ractool/main.go
+++ b/cmd/ractool/main.go
@@ -87,6 +87,8 @@
the chunk size (in DSpace)
-indexlocation
the index location, "start" or "end" (default "start")
+-resources
+ comma-separated list of resource files, such as shared dictionaries
*/
package main
@@ -122,6 +124,8 @@
dchunksizeFlag = flag.String("dchunksize", "0", "the chunk size (in DSpace)")
indexlocationFlag = flag.String("indexlocation", "start",
"the index location, \"start\" or \"end\"")
+ resourcesFlag = flag.String("resources", "",
+ "comma-separated list of resource files, such as shared dictionaries")
)
func usage() {
@@ -323,6 +327,16 @@
return errors.New("unsupported -codec")
}
+ if *resourcesFlag != "" {
+ for _, filename := range strings.Split(*resourcesFlag, ",") {
+ resource, err := ioutil.ReadFile(filename)
+ if err != nil {
+ return err
+ }
+ w.ResourcesData = append(w.ResourcesData, resource)
+ }
+ }
+
if _, err := io.Copy(w, r); err != nil {
return err
}