Class: M3u8::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/m3u8/cli.rb,
lib/m3u8/cli/diff_command.rb,
lib/m3u8/cli/inspect_command.rb,
lib/m3u8/cli/validate_command.rb

Overview

CLI provides a command-line interface for inspecting and validating m3u8 playlists

Defined Under Namespace

Classes: DiffCommand, InspectCommand, ValidateCommand

Constant Summary collapse

COMMANDS =
%w[inspect validate diff].freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv, stdin, stdout, stderr) ⇒ CLI

Returns a new instance of CLI.



18
19
20
21
22
23
# File 'lib/m3u8/cli.rb', line 18

def initialize(argv, stdin, stdout, stderr)
  @argv = argv.dup
  @stdin = stdin
  @stdout = stdout
  @stderr = stderr
end

Class Method Details

.run(argv, stdin, stdout, stderr) ⇒ Object



14
15
16
# File 'lib/m3u8/cli.rb', line 14

def self.run(argv, stdin, stdout, stderr)
  new(argv, stdin, stdout, stderr).run
end

Instance Method Details

#runObject



25
26
27
28
29
30
31
# File 'lib/m3u8/cli.rb', line 25

def run
  parse_global_options
  dispatch
rescue OptionParser::InvalidOption => e
  @stderr.puts e.message
  2
end