Class: Dpu::Cli
- Inherits:
-
Object
- Object
- Dpu::Cli
- Defined in:
- lib/dpu/cli.rb
Constant Summary collapse
- USAGE =
<<~EOS #{File.basename(Process.argv0)} path start_line_number end_line_number EOS
Class Method Summary collapse
Class Method Details
.run(argv) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/dpu/cli.rb', line 7 def run(argv) s_path, s_start_line_number, s_end_line_number = *argv if !s_path $stderr.puts(USAGE) exit(1) end path = Pathname(s_path). start_line_number = s_start_line_number&.to_i end_line_number = s_end_line_number&.to_i uri = Dpu.determine_permanent_uri( path, start_line_number: start_line_number, end_line_number: end_line_number, ) puts(uri) end |