terminal 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/bin/terminal +33 -36
- data/lib/terminal/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7d9969578830c35e3587d7eb183a5ddca80faf78
|
4
|
+
data.tar.gz: 9c18bf8cc1e40b0b02a50d153291ddd678cce02e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f84f5c8f4b3a26e5ca5c49d05d78ffdc99879e2e3087494f140054bfcac10f76b8c34ec3458a94161a0ebaed6504b09f31a8caa5e92718582a8bea1cb72a4db2
|
7
|
+
data.tar.gz: 7897b30eb970b80ec2cd72c212ef190eeb538f2c023b629e671168078f8dfab9f0e72ef6a665d531a8f1314efcaf32311a2e4526b8f1381c5b8df783e457d86d
|
data/Gemfile.lock
CHANGED
data/bin/terminal
CHANGED
@@ -4,51 +4,48 @@
|
|
4
4
|
$:.unshift(File.join(File.expand_path(File.dirname(__FILE__)), '..', 'lib'))
|
5
5
|
|
6
6
|
require 'terminal'
|
7
|
+
require 'optparse'
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
Usage:
|
11
|
-
$ cat output.text | terminal
|
12
|
-
$ terminal output.text
|
9
|
+
options = Struct.new(:preview,
|
10
|
+
:emoji_asset_path).new
|
13
11
|
|
14
|
-
|
15
|
-
|
16
|
-
$ terminal --help
|
12
|
+
option_parser = OptionParser.new do |opts|
|
13
|
+
opts.banner = "Usage: #{opts.program_name} [options] <input file>"
|
17
14
|
|
18
|
-
|
19
|
-
|
20
|
-
|
15
|
+
opts.on("--preview", "Preview in the browser") do
|
16
|
+
options.preview = true
|
17
|
+
end
|
21
18
|
|
22
|
-
|
23
|
-
|
19
|
+
opts.on("--emoji-asset-path=PATH", "Path or URL to emoji image files") do |path|
|
20
|
+
options.emoji_asset_path = path
|
21
|
+
end
|
24
22
|
|
25
|
-
|
26
|
-
|
27
|
-
|
23
|
+
opts.on_tail("-h", "--help", "Show this help documentation") do
|
24
|
+
puts opts
|
25
|
+
exit
|
26
|
+
end
|
28
27
|
|
29
|
-
|
30
|
-
|
31
|
-
|
28
|
+
opts.on_tail("-v", "--version", "Print the version") do
|
29
|
+
puts "terminal v#{Terminal::VERSION}"
|
30
|
+
exit
|
31
|
+
end
|
32
|
+
end.tap(&:parse!)
|
32
33
|
|
33
|
-
|
34
|
+
if ($stdin.tty? && ARGV.empty?)
|
35
|
+
abort option_parser.help
|
36
|
+
end
|
34
37
|
|
35
|
-
|
36
|
-
|
37
|
-
elsif ARGV.delete('-v') || ARGV.delete('--version')
|
38
|
-
version
|
39
|
-
else
|
40
|
-
raw = ARGF.read
|
41
|
-
rendered = Terminal.render(raw)
|
38
|
+
raw = ARGF.read
|
39
|
+
rendered = Terminal.render(raw, emoji_asset_path: options[:emoji_asset_path])
|
42
40
|
|
43
|
-
|
44
|
-
|
41
|
+
if options[:preview]
|
42
|
+
require 'tempfile'
|
45
43
|
|
46
|
-
|
47
|
-
|
48
|
-
|
44
|
+
tempfile = Tempfile.new([ 'preview', '.html' ])
|
45
|
+
tempfile.write(Terminal::Preview.new(raw, rendered).render)
|
46
|
+
tempfile.close
|
49
47
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
end
|
48
|
+
exec %{open "#{tempfile.path}"}
|
49
|
+
else
|
50
|
+
puts rendered
|
54
51
|
end
|
data/lib/terminal/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: terminal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Keith Pitt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: escape_utils
|