diff options
Diffstat (limited to 'distixlib/plugins/set_plugin.py')
-rw-r--r-- | distixlib/plugins/set_plugin.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/distixlib/plugins/set_plugin.py b/distixlib/plugins/set_plugin.py index 7a82e26..c840087 100644 --- a/distixlib/plugins/set_plugin.py +++ b/distixlib/plugins/set_plugin.py @@ -29,19 +29,23 @@ class SetPlugin(cliapp.Plugin): def enable(self): self.app.add_subcommand( - 'set', self.set, arg_synopsis='TICKETID KEY=VALUE...') + 'set', self.set, arg_synopsis='KEY=VALUE TICKETID ...') def set(self, args): '''Set ticket metadata.''' + key, value = self._parse_pair(args[0]) + ticket_ids = distixlib.get_ticket_ids(self.app.settings, args[1:]) + repo = distixlib.Repository('.') repo.require_clean_working_tree() - ticket_id = distixlib.get_ticket_ids(self.app.settings, [args[0]])[0] + ticket_store = repo.open_ticket_store(distixlib.tickets_dir_name) - ticket = ticket_store.get_ticket(ticket_id) - for pair in args[1:]: - key, value = self._parse_pair(pair) + + for ticket_id in ticket_ids: + ticket = ticket_store.get_ticket(ticket_id) ticket.add_metadata_key_value_pair(key, value) + filenames = ticket_store.save_changes() repo.commit_changes(filenames, self._commit_msg) |