arg0 0.0.1 → 0.0.2

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 (5) hide show
  1. data/CHANGELOG +13 -0
  2. data/README.md +2 -0
  3. data/lib/arg0.rb +4 -2
  4. data/lib/arg0/version.rb +1 -1
  5. metadata +2 -1
data/CHANGELOG ADDED
@@ -0,0 +1,13 @@
1
+ ##### v0.0.2
2
+
3
+ multiple synoymous arguments to be fetched
4
+ [+] Arg0::Console.switch? ['-s', '--start']
5
+ [+] Arg0::Console.value_for ['-p', '--path']
6
+
7
+ ##### v0.0.1
8
+
9
+ boolean if argument passed
10
+ [+] Arg0::Console.switch? '-start'
11
+
12
+ array for single or multiple same argument passed
13
+ [+] Arg0::Console.value_for '-path'
data/README.md CHANGED
@@ -25,10 +25,12 @@ to load it up
25
25
  to check if a bool-type switch is provided
26
26
 
27
27
  Arg0::Console.switch?('--is-arg')
28
+ Arg0::Console.switch?(['-isarg', '--is-arg']) # synonymous args
28
29
 
29
30
  returning array of (empty or) Value(s) provided after --my-arg at ARGV
30
31
 
31
32
  Arg0::Console.value_for('--my-arg')
33
+ Arg0::Console.value_for(['-myarg', '--my-arg']) # synonymous args
32
34
 
33
35
  ## Contributing
34
36
 
data/lib/arg0.rb CHANGED
@@ -7,13 +7,15 @@ end
7
7
  module Arg0
8
8
  module Console
9
9
  def self.switch?(switch_name)
10
- ARGV.include? switch_name
10
+ ! [switch_name].flatten.select {|switch|
11
+ ARGV.include? switch
12
+ }.empty?
11
13
  end
12
14
 
13
15
  def self.value_for(switch_name)
14
16
  values = []
15
17
  ARGV.each_with_index {|arg, index|
16
- if arg === switch_name
18
+ if [switch_name].flatten.include? arg
17
19
  values += [ARGV[index + 1]]
18
20
  end
19
21
  }
data/lib/arg0/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Arg0
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arg0
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -20,6 +20,7 @@ extensions: []
20
20
  extra_rdoc_files: []
21
21
  files:
22
22
  - .gitignore
23
+ - CHANGELOG
23
24
  - Gemfile
24
25
  - LICENSE.txt
25
26
  - README.md