record: Nummern unter 1 und Text sind ein Fehler statt Zeilen vom Ende
This commit is contained in:
@@ -72,6 +72,8 @@ end
|
||||
|
||||
Rdb.register('record', 'Find and output a record from a table', 'record number < table') do |args|
|
||||
die 'usage: record number < table' unless args.size == 1
|
||||
die "'#{args[0]}' is not a record number (1, 2, 3 ...)" unless args[0].match?(/\A\d+\z/) && args[0].to_i.positive?
|
||||
|
||||
t = table_in
|
||||
row = t.rows[args[0].to_i - 1]
|
||||
t.with(rows: row ? [row] : []).write
|
||||
|
||||
Reference in New Issue
Block a user