glam 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/glam.gemspec +1 -1
- data/lib/glam.rb +1 -1
- data/lib/glam/cli.rb +20 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a4a59bb7cf94a04f6965427b87ec36bdd271dda4
|
4
|
+
data.tar.gz: 754b5ffb41d0b72f2b8bd049c32569e30dec667c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 09830db411522642371cb0550b052da1b5276222649a71f11e4f6fd8804c3af876e3dec57f97f0b8bb2a3cf55f358f99e8212085b995ff501a88964671c2f5cb
|
7
|
+
data.tar.gz: 87447b14ac94022d05d583f3e961164ffa9781c17cdbdbe1e8bf86bd7663cc61b96390ea9a53da23e99f391553d7ef96d130666f4de9c8a40c21c3d12785dc6a
|
data/glam.gemspec
CHANGED
data/lib/glam.rb
CHANGED
data/lib/glam/cli.rb
CHANGED
@@ -16,23 +16,40 @@ module Glam
|
|
16
16
|
|
17
17
|
def run
|
18
18
|
@parser = OptionParser.new do |o|
|
19
|
-
o.on "-i", "--indent [INDENT]", Integer do |indent_size|
|
19
|
+
o.on "-i", "--indent [INDENT]", "How many spaces to indent at each level", Integer do |indent_size|
|
20
20
|
@options[:indent_size] = indent_size
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
-
@parser.banner = "glam [options] file"
|
24
|
+
@parser.banner = "glam #{Glam::VERSION}\n\nUsage: glam [options] file"
|
25
25
|
|
26
26
|
@parser.on_tail "-h", "--help", "Show help" do
|
27
27
|
$stderr.puts @parser
|
28
28
|
exit 1
|
29
29
|
end
|
30
30
|
|
31
|
+
@parser.on_tail "-v", "--version", "Print the version" do
|
32
|
+
$stderr.puts Glam::VERSION
|
33
|
+
exit 2
|
34
|
+
end
|
35
|
+
|
31
36
|
@parser.parse!
|
32
37
|
|
33
38
|
glam = Glam::Glamorizer.new(@options)
|
34
39
|
|
35
|
-
|
40
|
+
html = if ARGV[0]
|
41
|
+
file = File.expand_path(ARGV[0])
|
42
|
+
if File.exists?(file)
|
43
|
+
File.read(file)
|
44
|
+
else
|
45
|
+
$stderr.puts "#{file} does not exist"
|
46
|
+
exit 3
|
47
|
+
end
|
48
|
+
else
|
49
|
+
STDIN.read
|
50
|
+
end
|
51
|
+
|
52
|
+
puts glam.glamorize(html)
|
36
53
|
end
|
37
54
|
end
|
38
55
|
end
|