shell_explain 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/shell_explain/version.rb +1 -1
- data/lib/shell_explain.rb +19 -19
- data/scripts/console.rb +12 -0
- data/shell_explain.gemspec +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 39bb0e5dc5c40e4be6ba70b0c4412b448784475e
|
4
|
+
data.tar.gz: 8b3c498fce196440f0597ebda869238b16e2670f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a30cba41daf2223002ffb44a354d6c1ddf297094b75e079f6ab5314ffe00e98c02756d69e1c9d035f197ea779db507f57563bc7724c91f2f1f0938b6f070c319
|
7
|
+
data.tar.gz: 8c2fc79e0bc4c4f6e2d4d948b44c6d01a1b6929724476f07c9b49eaba3aa3a047162509a52989567cf6ad2e6d2266e1ea129fb8c2ac6669407544846816c1700
|
data/lib/shell_explain.rb
CHANGED
@@ -7,28 +7,28 @@ module ShellExplain
|
|
7
7
|
class Site
|
8
8
|
|
9
9
|
class << self
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
10
|
+
def get_data(cmd)
|
11
|
+
explain_shell_url = "http://explainshell.com/explain?cmd="
|
12
|
+
uri = URI("#{explain_shell_url}#{CGI.escape(cmd)}")
|
13
|
+
html = Net::HTTP.get_response(uri).body
|
14
|
+
Nokogiri::HTML(html)
|
15
|
+
end
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
17
|
+
#{command: help-num}
|
18
|
+
def get_command(doc)
|
19
|
+
doc.xpath("//span[@helpref]").inject({}) do|cmds, node|
|
20
|
+
cmds[node.text] = node.attributes["helpref"].value
|
21
|
+
cmds
|
22
|
+
end
|
23
|
+
end
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
def get_explain(doc)
|
26
|
+
data = doc.xpath("//table[@id='help']//pre").inject([]) do|exps, node|
|
27
|
+
exps << node.children.text
|
28
|
+
end
|
29
|
+
data
|
28
30
|
end
|
29
|
-
|
30
|
-
end
|
31
|
-
end
|
31
|
+
end
|
32
32
|
|
33
33
|
end
|
34
34
|
end
|
data/scripts/console.rb
ADDED
data/shell_explain.gemspec
CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
|
|
11
11
|
spec.email = ["blackanger.z@gmail.com"]
|
12
12
|
spec.description = %q{explainshell.com input from terminal}
|
13
13
|
spec.summary = %q{explainshell.com for terminal}
|
14
|
-
spec.homepage = ""
|
14
|
+
spec.homepage = "https://github.com/ZhangHanDong/shell_explain"
|
15
15
|
spec.license = "MIT"
|
16
16
|
|
17
17
|
spec.files = `git ls-files`.split($/)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shell_explain
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- blackanger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-11-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ansi
|
@@ -85,8 +85,9 @@ files:
|
|
85
85
|
- img/explain_shell2.png
|
86
86
|
- lib/shell_explain.rb
|
87
87
|
- lib/shell_explain/version.rb
|
88
|
+
- scripts/console.rb
|
88
89
|
- shell_explain.gemspec
|
89
|
-
homepage:
|
90
|
+
homepage: https://github.com/ZhangHanDong/shell_explain
|
90
91
|
licenses:
|
91
92
|
- MIT
|
92
93
|
metadata: {}
|