bogo-cli 0.1.14 → 0.1.16

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dffae677b424893ee535b80f0210259286c4cdac
4
- data.tar.gz: 7a75264f2f27dbe32584e2bad6cf7c351a3f0855
3
+ metadata.gz: c670e873f40bafcaba50ba35187b1762bfe3dd56
4
+ data.tar.gz: c77af64b71894e00c8ed25ea54a6a5cf55a456af
5
5
  SHA512:
6
- metadata.gz: f16d9ce05dd3ca7145fcccf404051a1ac33c1c3acc1c4442a5f50f08d1acc77815e13ab2c922daaffa28d09ec0269836bf76f39146f72a969d80986230c6b401
7
- data.tar.gz: d26740477cb5b98c64d9bfbf593e51e83dda4bc7eb56dea78dacac812000c48ff404d63462604f6b4bbcd2d952ee9f5ca0edd82c1e9301b0351c15a33cd3f59c
6
+ metadata.gz: 41c7b2df9c2775b2c90268eead7c32756f92b85b8abd98afc3a452713cf82a8ddaae4249ccce7d4fb7a775383472f7ec6c4d9398b3a7c09b7defb38320c13f08
7
+ data.tar.gz: d592dea8aeaf00fc55a7a07bda5a9568d9e15d8ae04baf0b4b3df4bed4a9f731c2e87ee375ec29e2237a3fb065f89c76caaf111af19482dd1030a51fdac1ed86
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## v0.1.16
2
+ * Output exception message when reporting error to get full content
3
+ * Trap INT to allow nicer user forced exits
4
+ * Automatically exit after command block is run
5
+ * Print help message and exit non-zero when no command is run
6
+
1
7
  ## v0.1.14
2
8
  * Merge namespaced opts with globals when providing options to allow full config load
3
9
 
@@ -1,6 +1,18 @@
1
+ Signal.trap('INT'){ exit -1 }
2
+
1
3
  require 'slop'
2
4
  require 'bogo-cli'
3
5
 
6
+ class Slop
7
+ def bogo_cli_run(*args, &block)
8
+ slop_run(*args, &block)
9
+ old_runner = @runner
10
+ @runner = proc{|*args| old_runner.call(*args); exit 0}
11
+ end
12
+ alias_method :slop_run, :run
13
+ alias_method :run, :bogo_cli_run
14
+ end
15
+
4
16
  module Bogo
5
17
  module Cli
6
18
  class Setup
@@ -12,14 +24,16 @@ module Bogo
12
24
  # @return [TrueClass]
13
25
  def define(&block)
14
26
  begin
15
- Slop.parse(:help => true) do
27
+ slop_result = Slop.parse(:help => true) do
16
28
  instance_exec(&block)
17
29
  end
30
+ puts slop_result.help
31
+ exit -1
18
32
  rescue StandardError, ScriptError => e
19
33
  if(ENV['DEBUG'])
20
34
  $stderr.puts "ERROR: #{e.class}: #{e}\n#{e.backtrace.join("\n")}"
21
35
  else
22
- $stderr.puts "ERROR: #{e.class}: #{e}"
36
+ $stderr.puts "ERROR: #{e.class}: #{e.message}"
23
37
  end
24
38
  exit e.respond_to?(:exit_code) ? e.exit_code : -1
25
39
  end
@@ -1,6 +1,6 @@
1
1
  module Bogo
2
2
  module Cli
3
3
  # Current library version
4
- VERSION = Gem::Version.new('0.1.14')
4
+ VERSION = Gem::Version.new('0.1.16')
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bogo-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.14
4
+ version: 0.1.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Roberts
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-13 00:00:00.000000000 Z
11
+ date: 2015-04-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bogo