trello_tool 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 778c425dfbc472059095e0828cf610ed2e0cd1d5038b01d58bda36b378203739
4
- data.tar.gz: 544450eb3a55ce0dbdf788ea71d306c603972c16e95a764191e98f4d97f5daf7
3
+ metadata.gz: 84c1b337fcadccc4027363a3f4610519c2708a4787324f31fbe5ba855869ad30
4
+ data.tar.gz: b94417d688d1b508defd797eafeb8836ec96235f535194c6089a71abe29ee10d
5
5
  SHA512:
6
- metadata.gz: e9a6723067237ff49d86675866d1b7081279cb1170821fce7735a55d539eb49361a162a0559e0c912bc9c1b0dc082b217a6d5fc45f5d2e971b7114fa4fd0a498
7
- data.tar.gz: 1faafabc10d1c606d10f308f3bd0842ccd00ffb585034df46de68ecb0f83dd83436a3a2170dee5695c7d1bd6349f94fdaf153c40998d3a3c7734877ac4372a53
6
+ metadata.gz: e919e579523a39911b8695b40f9fe5168f295b30aacf86f19f5bcb7b67f68bfb68ab0a4cfbd257e7be5b76873b434a281f8bb4bf55e138546747c0bf091d62e7
7
+ data.tar.gz: 90cddd46749bdd2f99d60d0bb9f5ecda4c337403e95e27b8a1059e9f57fb3d83dd3cb534cdf3db82ec02d15c1be16e876373d68f9daf3327651b8a7870e95516
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## [0.7.0] - 2026-10-15
2
+
3
+ * added `rename_checklist`
4
+
1
5
  ## [0.6.0] - 2026-10-14
2
6
 
3
7
  * `card` also prints the card's list, members, labels and comments
data/README.md CHANGED
@@ -105,6 +105,7 @@ Changing cards:
105
105
  text, or the only item containing it
106
106
  * `bin/trello_tool rename_item CARD "item text" "new text" (--checklist NAME)` -- renames the item with that
107
107
  text, or the only item containing it
108
+ * `bin/trello_tool rename_checklist CARD "Name" "New name"` -- renames the card's checklist of that name
108
109
  * `bin/trello_tool remove_item CARD "item text" (--checklist NAME)` -- deletes that item. The one command that
109
110
  destroys something, so keep it behind a prompt where agents run the tool
110
111
  * `bin/trello_tool move CARD (LIST_NAME (BOARD_URL)) (--top | --bottom)` -- to the bottom (or top) of a list; without
@@ -108,6 +108,11 @@ module TrelloTool
108
108
  client.delete("/cards/#{card.id}/checkItem/#{item['id']}")
109
109
  end
110
110
 
111
+ # @param checklist [Trello::Checklist]
112
+ def rename_checklist(checklist, name:)
113
+ client.put("/checklists/#{checklist.id}", name: name)
114
+ end
115
+
111
116
  # @return [Trello::Member] the member the token belongs to
112
117
  def me
113
118
  client.find(:members, "me")
@@ -125,12 +130,13 @@ module TrelloTool
125
130
  board_of(card).members
126
131
  end
127
132
 
133
+ COMMENT_PARAMS = { "filter" => "commentCard", "fields" => "data,date", "memberCreator" => "true",
134
+ "memberCreator_fields" => "username" }.freeze
135
+
128
136
  # @param card [Trello::Card]
129
137
  # @return [Array<Hash>] the card's comments, oldest first: author (username), date, text
130
138
  def card_comments(card)
131
- response = client.get("/cards/#{card.id}/actions", "filter" => "commentCard", "fields" => "data,date",
132
- "memberCreator" => "true", "memberCreator_fields" => "username")
133
- JSON.parse(response.body).reverse.map do |action|
139
+ JSON.parse(client.get("/cards/#{card.id}/actions", COMMENT_PARAMS).body).reverse.map do |action|
134
140
  { author: action.dig("memberCreator", "username"), date: action["date"], text: action.dig("data", "text") }
135
141
  end
136
142
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TrelloTool
4
- VERSION = "0.6.0"
4
+ VERSION = "0.7.0"
5
5
  end
@@ -350,6 +350,22 @@ class TrelloToolThor < Thor
350
350
  say "removed #{item['name'].inspect} from #{card.url}"
351
351
  end
352
352
 
353
+ desc "rename_checklist CARD_ID_OR_URL NAME NEW_NAME", "renames the card's checklist of that name"
354
+
355
+ def rename_checklist(card_id_or_url, name, new_name)
356
+ raise Thor::Error, "the new name is empty" if new_name.to_s.strip.empty?
357
+
358
+ card = client.find_card(extract_card_id(card_id_or_url))
359
+ checklist = card.checklists.detect { |candidate| candidate.name == name }
360
+ unless checklist
361
+ raise Thor::Error, "no checklist called #{name.inspect} on #{card.url}. " \
362
+ "Checklists: #{card.checklists.map { |candidate| candidate.name.inspect }.join(', ')}"
363
+ end
364
+
365
+ client.rename_checklist(checklist, name: new_name)
366
+ say "renamed checklist #{name.inspect} to #{new_name.inspect} on #{card.url}"
367
+ end
368
+
353
369
  private
354
370
 
355
371
  # @param present [Array<Trello::Label>] labels the card already had
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trello_tool
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Diggins