Skip to content

Commit

Permalink
add merge command and sample csv file
Browse files Browse the repository at this point in the history
  • Loading branch information
dorianmariecom committed Sep 10, 2024
1 parent 1cafe0b commit 8867967
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/dorian/bin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ def initialize
},
parallel: {
alias: :p,
default: true
},
parallel_type: {
alias: :pt,
Expand Down Expand Up @@ -218,6 +217,10 @@ def run
arguments.delete("lstrip")
@command = :lstrip
command_lstrip
when :merge
arguments.delete("merge")
@command = :merge
command_merge
else
arguments.delete("read")
@command = :read
Expand Down Expand Up @@ -414,6 +417,10 @@ def command_each
end
end

def command_merge
outputs(map(everything) { |thing| lines(reads(thing)) }.inject(&:+))
end

def command_tally
each(everything) do |input|
outputs(
Expand Down
6 changes: 6 additions & 0 deletions samples/people.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Name,Age,City,Occupation
Alice,30,New York,Engineer
Bob,25,Los Angeles,Designer
Charlie,35,Chicago,Teacher
Diana,28,Miami,Developer
Edward,40,San Francisco,Manager

0 comments on commit 8867967

Please sign in to comment.