Class: Zencoder::CLI::Command::Base

Inherits:
Object
  • Object
show all
Extended by:
Helpers
Defined in:
lib/zencoder-cli/commands/base.rb

Direct Known Subclasses

Account, Job, Jobs, Output, Plugins, Setup

Class Method Summary collapse

Methods included from Helpers

ask, confirm, display, error, format_date, home_directory, running_on_a_mac?, running_on_windows?, truncate

Class Method Details

.extract_id(args) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/zencoder-cli/commands/base.rb', line 11

def extract_id(args)
  arg = args.shift
  if arg.to_s.strip[/^\d+$/]
    arg
  else
    print "Enter an ID: "
    id = ask
    if id.present?
      id
    else
      puts "No ID given. Aborting."
      exit 1
    end
  end
end

.provides(name, commands = {}) ⇒ Object



7
8
9
# File 'lib/zencoder-cli/commands/base.rb', line 7

def provides(name, commands={})
  Zencoder::CLI::Command.commands.merge!({ name => commands })
end