motivator 1.0.3 → 1.0.4

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.
Files changed (3) hide show
  1. checksums.yaml +8 -8
  2. data/lib/command_parser.rb +9 -5
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ODc5ZDg1NDNiNzRiMGViMmMzNWQ1ODBlYzFlNjJhNWZhNTQ5OTBkNA==
4
+ NGQwMTcyOWNmYjkxNjA4MmU1ZTlhZTUyZDUwNDA4Yjk5NzBiZWNkMw==
5
5
  data.tar.gz: !binary |-
6
- MzVjMzAxY2NlZGJhNzhjMDkyYWUzYTU3ZDMxZjUzOGM2OTFkMjdkNw==
6
+ OTNkNDdiYzZlY2VlMjIzNWMyYmRlOTY5NzgyMDAyYTJhOTdlYTk5Mg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NTdjODIyYzY2MDE2YjA0YWM1MWEyZmY2ODM2NWNiN2FlZTNiOTc2YWExMTQ2
10
- ZDBkMjQ5YWNhMTkxNGRiNTg2YWIzZmJkY2Q0MGQ5NGMyMzZmYjcwM2UyYzU1
11
- MzYyNWQ5ZTkwNWU5M2I2NjFjNjdjNDAwZDg3YjhiYzFjMmRjOTg=
9
+ MTdjNDczNzUzZjM3N2VhNzg1NzQ4MWNiZGVlMmFkN2EwYzVmZGY1NzJhMWNl
10
+ MWMxMzQ3MGMyOTVlMTY0ZTMwZDFlN2YzYTkxZDE5NDM4N2FlYWRkYzEwZWY1
11
+ N2MxNTE4YzFlZjEzZmE2MmRhMzMzMGE2YzdkZmNhY2YyNjBjZDM=
12
12
  data.tar.gz: !binary |-
13
- MTVjN2IzZWIzOTdjYTE1M2JjMDg3YzA2YWNmMTExYjM4NWY4YjQ3ZjMyOTdl
14
- NGFhNzNlNTZiZmZlYTRhYmMxNjE2NTQ1NDVhNTVmNTczMTgzMGYzODAxOTNi
15
- ZTgwYzdiZTFkNzk1ODBiODdjNmRmODJmZWEzZTI2NTNiZmI4OGI=
13
+ NWVmNGY4MTFiNDk5ZTdiOTE5Y2UxYWQ4ZWZhMGIwODM3ZTMzZmU5MmRjNGMx
14
+ MmRmNTYwM2MxYzlkYzliZWUyNmIyYmMwOTNiNTcwMDhkNGU1ZDI0NTAyN2Nk
15
+ NTU5MDk3MTU5OGQ2MmViNjVjYjAxNDE0Y2Q0NzNjMjI1MTIwMGI=
@@ -6,6 +6,7 @@ class CommandParser
6
6
  def initialize config
7
7
  @config = config
8
8
  @options = options
9
+ @help_called = false
9
10
  end
10
11
 
11
12
  # default options
@@ -32,8 +33,9 @@ class CommandParser
32
33
  end
33
34
 
34
35
  opts.on_tail('-h', '--help', '# Output command line help options') do
36
+ @help_called = true
35
37
  puts opts
36
- exit
38
+ exit(1)
37
39
  end
38
40
  end
39
41
 
@@ -42,14 +44,16 @@ class CommandParser
42
44
  begin
43
45
  parser.parse!(arguments)
44
46
  rescue Exception => e
45
- puts parser
46
- exit(1)
47
+ if not(e.kind_of? SystemExit)
48
+ puts parser
49
+ exit(1)
50
+ end
47
51
  end
48
52
 
49
53
  # if no valid methods were set we can't execute and therefore we exit and
50
54
  # put the parser message to the console
51
- if @options[:method].nil?
52
- puts parser
55
+ if @options[:method].nil?
56
+ puts parser if not @help_called
53
57
  exit(1)
54
58
  end
55
59
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: motivator
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hugo Rut