X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/9b83c3ee103d121e9406fa93e6e95ad303dee577..905283aa36b36d51c2c4376489cd97b34b488104:/tools/arv-sync-groups/arv-sync-groups.go diff --git a/tools/arv-sync-groups/arv-sync-groups.go b/tools/arv-sync-groups/arv-sync-groups.go index c853cd3266..6b4781c354 100644 --- a/tools/arv-sync-groups/arv-sync-groups.go +++ b/tools/arv-sync-groups/arv-sync-groups.go @@ -19,6 +19,8 @@ import ( "git.curoverse.com/arvados.git/sdk/go/arvados" ) +var version = "dev" + type resourceList interface { Len() int GetItems() []interface{} @@ -150,6 +152,10 @@ func ParseFlags(config *ConfigParams) error { "verbose", false, "Log informational messages. Off by default.") + getVersion := flags.Bool( + "version", + false, + "Print version information and exit.") parentGroupUUID := flags.String( "parent-group-uuid", "", @@ -158,6 +164,12 @@ func ParseFlags(config *ConfigParams) error { // Parse args; omit the first arg which is the command name flags.Parse(os.Args[1:]) + // Print version information if requested + if *getVersion { + fmt.Printf("arv-sync-groups %s\n", version) + os.Exit(0) + } + // Input file as a required positional argument if flags.NArg() == 0 { return fmt.Errorf("please provide a path to an input file") @@ -276,7 +288,7 @@ func doMain(cfg *ConfigParams) error { } defer f.Close() - log.Printf("Group sync starting. Using %q as users id and parent group UUID %q", cfg.UserID, cfg.ParentGroupUUID) + log.Printf("arv-sync-groups %s started. Using %q as users id and parent group UUID %q", version, cfg.UserID, cfg.ParentGroupUUID) // Get the complete user list to minimize API Server requests allUsers := make(map[string]arvados.User) @@ -345,6 +357,7 @@ func ProcessFile( ) (groupsCreated, membersAdded, membersSkipped int, err error) { lineNo := 0 csvReader := csv.NewReader(f) + csvReader.FieldsPerRecord = 2 for { record, e := csvReader.Read() if e == io.EOF {