moss 0.3 → 0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/moss +24 -7
  3. data/lib/version.rb +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a1b0266d73a0f4b0544efd54ec709fc723b83064
4
- data.tar.gz: f684dce933b9378aa77615f02ff32f7e35d8742f
3
+ metadata.gz: ce897eae9d6b779e9b2cae4c05c3bce7a0ca3cda
4
+ data.tar.gz: e5172a2c02edc0f5edeef30fc1af25cf0c44ad61
5
5
  SHA512:
6
- metadata.gz: f8e12f8a4261e68a169e25096aba8ef1794eeaa9538fc78e6a4c8b6d503cadabd6049ded90d2e6eeb431178fb7838c41f1dd5476c01b9401feaded04713bbce5
7
- data.tar.gz: 4d2cf15f8284d69b101b99546ee4862fcaa699a59fbccd702a774a51737ca3a27a0597118d0e08512aefd56d8dc874822a32093b9c0889babc4a88197b6b802c
6
+ metadata.gz: fc9959baf953ddb98b0c905a1204bc945bbdd9465b30e1ba71107b36a6ffcb81b1b28ab9a70f87fe206644fe58ffb895e907360f9c4386401a0008ddf1e1f57c
7
+ data.tar.gz: d259e0f7fe65702ef5ac9360fe7f2002419aba1c8834965a047bb42066a2fc53afa803bc6d3d5563ae61e56e30bbcb1ea5d46b6ae30520b5600d15c4e75b77b0
data/bin/moss CHANGED
@@ -1,15 +1,32 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- def usage
4
- puts "Usage: moss [options] <file 1> <file 2>"
5
- puts "-h Print usage info"
6
- exit 0
7
- end
3
+ require 'optparse'
8
4
 
9
5
  def main
10
- usage if ARGV == ['-h'] || ARGV.length != 2
6
+ color = $stdout.isatty
7
+
8
+ option = OptionParser.new do |option|
9
+ option.banner = 'Usage: moss [options] <file 1> <file 2>'
10
+
11
+ option.on('-c', '--color', 'Enable colors (on by default for tty\'s') do
12
+ color = true
13
+ end
14
+
15
+ option.on('-h', '--help', 'Print usage info') do
16
+ puts option
17
+ exit
18
+ end
19
+ end
20
+
21
+ option.parse!
22
+
23
+ if ARGV.length != 2 then
24
+ puts option
25
+ exit
26
+ end
27
+
11
28
 
12
- output = `git diff #{ if $stdout.isatty then "--color-words" else "" end } --no-index #{ARGV.join ' '}`
29
+ output = `git diff #{ if color then "--color-words" else "" end } --no-index #{ARGV.join ' '}`
13
30
 
14
31
  puts output
15
32
  end
@@ -2,5 +2,5 @@
2
2
  # Moss
3
3
  #
4
4
  module Moss
5
- VERSION = '0.3'
5
+ VERSION = '0.4'
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: moss
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.3'
4
+ version: '0.4'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Pennebaker