truenorth 0.2.1 → 0.2.3
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 +4 -4
- data/lib/truenorth/cli.rb +26 -4
- data/lib/truenorth/version.rb +1 -1
- data/truenorth.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a5f3438794269dffcf86a880d84a026215705c4f209224788e6ea23455b14ea1
|
|
4
|
+
data.tar.gz: 01de8411d76be106e62a870885011c27cd10ec2df715af9300be9c1c6c545b75
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5a9f8bb510b0d8e697dba433e05ff634dbb433a449afffbfef66eebb1cd0c371bc8533d3e858f397642ee5e722987d71693395a2b2133ef21f4281f93e5c3820
|
|
7
|
+
data.tar.gz: d383619f1d8df6b96f1628a7e6b642a6739b1f3ba7c74c4d0d8fa8b944a8b2f92f75e73d9be482a84654f8b15ec8de22d05153b7f7c29d3adbbc4949b415bd7f
|
data/lib/truenorth/cli.rb
CHANGED
|
@@ -97,6 +97,7 @@ module Truenorth
|
|
|
97
97
|
|
|
98
98
|
desc 'reservations', 'List your current reservations'
|
|
99
99
|
option :json, type: :boolean, desc: 'Output as JSON'
|
|
100
|
+
option :all, type: :boolean, aliases: '-a', desc: 'Show all family members (default: only you)'
|
|
100
101
|
def reservations
|
|
101
102
|
client = Client.new
|
|
102
103
|
|
|
@@ -109,7 +110,26 @@ module Truenorth
|
|
|
109
110
|
if results.empty?
|
|
110
111
|
say 'No reservations found.', :yellow
|
|
111
112
|
else
|
|
112
|
-
|
|
113
|
+
# Filter to only "You" unless --all is specified
|
|
114
|
+
your_reservations = results.select { |r| r[:member].nil? }
|
|
115
|
+
other_count = results.length - your_reservations.length
|
|
116
|
+
|
|
117
|
+
if options[:all]
|
|
118
|
+
display_reservations_table(results)
|
|
119
|
+
else
|
|
120
|
+
if your_reservations.empty?
|
|
121
|
+
say 'You have no reservations.', :yellow
|
|
122
|
+
if other_count > 0
|
|
123
|
+
say "Note: #{other_count} reservation#{'s' if other_count != 1} for other family members", :cyan
|
|
124
|
+
say "Use 'truenorth reservations --all' to see all", :cyan
|
|
125
|
+
end
|
|
126
|
+
else
|
|
127
|
+
display_reservations_table(your_reservations)
|
|
128
|
+
if other_count > 0
|
|
129
|
+
say "\nNote: #{other_count} reservation#{'s' if other_count != 1} for other family members (use --all to show)", :cyan
|
|
130
|
+
end
|
|
131
|
+
end
|
|
132
|
+
end
|
|
113
133
|
end
|
|
114
134
|
end
|
|
115
135
|
rescue Error => e
|
|
@@ -200,11 +220,12 @@ module Truenorth
|
|
|
200
220
|
col_idx = 4 # Index column
|
|
201
221
|
col_date = 6 # Date column (MM-DD)
|
|
202
222
|
col_time = 16 # Time column (HH:MM (XXXmin))
|
|
223
|
+
col_court = 18 # Court/Location column
|
|
203
224
|
col_member = 17 # Member column
|
|
204
|
-
fixed_width = col_idx + col_date + col_time + col_member +
|
|
225
|
+
fixed_width = col_idx + col_date + col_time + col_court + col_member + 12 # +12 for padding/borders
|
|
205
226
|
|
|
206
227
|
# Activity column gets remaining space
|
|
207
|
-
col_activity = [term_width - fixed_width,
|
|
228
|
+
col_activity = [term_width - fixed_width, 15].max
|
|
208
229
|
|
|
209
230
|
# Prepare table data
|
|
210
231
|
rows = results.each_with_index.map do |res, idx|
|
|
@@ -219,13 +240,14 @@ module Truenorth
|
|
|
219
240
|
format_compact_date(res[:date]),
|
|
220
241
|
format_compact_time(res[:time]),
|
|
221
242
|
truncate_text(res[:activity] || '', col_activity),
|
|
243
|
+
truncate_text(res[:court] || '', col_court),
|
|
222
244
|
member_display
|
|
223
245
|
]
|
|
224
246
|
end
|
|
225
247
|
|
|
226
248
|
# Create table
|
|
227
249
|
table = TTY::Table.new(
|
|
228
|
-
header: ['#', 'Date', 'Time', 'Activity', 'Member'],
|
|
250
|
+
header: ['#', 'Date', 'Time', 'Activity', 'Court', 'Member'],
|
|
229
251
|
rows: rows
|
|
230
252
|
)
|
|
231
253
|
|
data/lib/truenorth/version.rb
CHANGED
data/truenorth.gemspec
CHANGED