zencoder-cli 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,13 @@
1
1
  Zencoder::CLI::Plugin.load!
2
2
 
3
+ head = "#{"-" * (14 + Zencoder::CLI::GEM_VERSION.length)}
4
+ Zencoder CLI v#{Zencoder::CLI::GEM_VERSION}
5
+ #{"-" * (14 + Zencoder::CLI::GEM_VERSION.length)}"
6
+
3
7
  global_options = Trollop::options do
4
8
  version "Zencoder #{Zencoder::CLI::GEM_VERSION}"
5
9
  banner <<-EOS
6
- #{"-" * (14 + Zencoder::CLI::GEM_VERSION.length)}
7
- Zencoder CLI v#{Zencoder::CLI::GEM_VERSION}
8
- #{"-" * (14 + Zencoder::CLI::GEM_VERSION.length)}
10
+ #{head}
9
11
 
10
12
  == Usage
11
13
 
@@ -39,9 +41,23 @@ args = ARGV
39
41
  flat_commands = Zencoder::CLI::Command.commands.values.inject({}){|memo,group| memo.merge!(group) }
40
42
  command_options = Trollop::options do
41
43
  banner <<-EOS
44
+ #{head}
45
+ #{
46
+ if flat_commands[command][:help]
47
+ "\n"+flat_commands[command][:help]+"\n"
48
+ end
49
+ }
42
50
  == Usage
43
51
 
44
- zencoder [global-options] #{command} [options]
52
+ zencoder [global-options] #{command}#{" [args]" if flat_commands[command][:arguments]} [options]
53
+ #{
54
+ if flat_commands[command][:arguments]
55
+ "\n== Arguments\n\n"+
56
+ (1..flat_commands[command][:arguments].size).to_a.map{|i|
57
+ "#{i}: #{flat_commands[command][:arguments][i-1].to_s}"
58
+ }.join("\n")
59
+ end
60
+ }
45
61
 
46
62
  == Command Options
47
63
  EOS
@@ -39,11 +39,16 @@ module Zencoder::CLI::Command
39
39
 
40
40
 
41
41
  class Job < Base
42
- provides "job", "job" => { :description => "Show job details by ID", :help => "" },
43
- "job:open" => "Opens the job in the dashboard",
44
- "job:resubmit" => "Resubmit a job by ID",
45
- "job:cancel" => "Cancels a job by ID",
46
- "job:delete" => "Deletes a job by ID"
42
+ provides "job", "job" => { :description => "Show job details by ID",
43
+ :arguments => ["job_id"] },
44
+ "job:open" => { :description => "Opens the job in the dashboard",
45
+ :arguments => ["job_id"] },
46
+ "job:resubmit" => { :description => "Resubmit a job by ID",
47
+ :arguments => ["job_id"] },
48
+ "job:cancel" => { :description => "Cancels a job by ID",
49
+ :arguments => ["job_id"] },
50
+ "job:delete" => { :description => "Deletes a job by ID",
51
+ :arguments => ["job_id"] }
47
52
  class << self
48
53
 
49
54
  def run(args, global_options, command_options)
@@ -146,8 +151,9 @@ module Zencoder::CLI::Command
146
151
 
147
152
  def extract_job_id(args)
148
153
  job_id = args.shift
154
+ method_name = caller.first[/`(.*)'$/, 1]
149
155
  if !job_id.to_s.strip[/^\d+$/]
150
- puts "You must specify the job to show. Try `zencoder jobs:show --help` for more information."
156
+ puts "You must specify the job to show. Try `zencoder job#{":"+method_name unless method_name == "run"} --help` for more information."
151
157
  exit 1
152
158
  end
153
159
  job_id
@@ -1,5 +1,5 @@
1
1
  module Zencoder
2
2
  module CLI
3
- GEM_VERSION = '0.1.2'
3
+ GEM_VERSION = '0.1.3'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zencoder-cli
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 2
10
- version: 0.1.2
9
+ - 3
10
+ version: 0.1.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Brandon Arbini