hookapp 2.0.7 → 2.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/AUTHORS.md +4 -0
- data/CHANGELOG.md +13 -0
- data/Gemfile.lock +35 -40
- data/LICENSE +21 -0
- data/README.md +32 -22
- data/bin/hook +57 -67
- data/hook.rdoc +16 -11
- data/hookapp.gemspec +1 -0
- data/html/App.html +107 -0
- data/html/GLI/Commands/Doc.html +91 -0
- data/html/GLI/Commands/MarkdownDocumentListener.html +521 -0
- data/html/GLI/Commands.html +91 -0
- data/html/GLI.html +91 -0
- data/html/Hook/Prompt.html +100 -0
- data/html/Hook/PromptFZF.html +243 -0
- data/html/Hook/PromptSTD.html +177 -0
- data/html/Hook.html +100 -0
- data/html/HookApp.html +1008 -0
- data/html/Hooker.html +141 -0
- data/html/README_rdoc.html +354 -0
- data/html/String.html +335 -0
- data/html/created.rid +10 -0
- data/html/css/fonts.css +167 -0
- data/html/css/rdoc.css +639 -0
- data/html/fonts/Lato-Light.ttf +0 -0
- data/html/fonts/Lato-LightItalic.ttf +0 -0
- data/html/fonts/Lato-Regular.ttf +0 -0
- data/html/fonts/Lato-RegularItalic.ttf +0 -0
- data/html/fonts/SourceCodePro-Bold.ttf +0 -0
- data/html/fonts/SourceCodePro-Regular.ttf +0 -0
- data/html/images/add.png +0 -0
- data/html/images/arrow_up.png +0 -0
- data/html/images/brick.png +0 -0
- data/html/images/brick_link.png +0 -0
- data/html/images/bug.png +0 -0
- data/html/images/bullet_black.png +0 -0
- data/html/images/bullet_toggle_minus.png +0 -0
- data/html/images/bullet_toggle_plus.png +0 -0
- data/html/images/date.png +0 -0
- data/html/images/delete.png +0 -0
- data/html/images/find.png +0 -0
- data/html/images/loadingAnimation.gif +0 -0
- data/html/images/macFFBgHack.png +0 -0
- data/html/images/package.png +0 -0
- data/html/images/page_green.png +0 -0
- data/html/images/page_white_text.png +0 -0
- data/html/images/page_white_width.png +0 -0
- data/html/images/plugin.png +0 -0
- data/html/images/ruby.png +0 -0
- data/html/images/tag_blue.png +0 -0
- data/html/images/tag_green.png +0 -0
- data/html/images/transparent.png +0 -0
- data/html/images/wrench.png +0 -0
- data/html/images/wrench_orange.png +0 -0
- data/html/images/zoom.png +0 -0
- data/html/index.html +320 -0
- data/html/js/darkfish.js +84 -0
- data/html/js/navigation.js +105 -0
- data/html/js/navigation.js.gz +0 -0
- data/html/js/search.js +110 -0
- data/html/js/search_index.js +1 -0
- data/html/js/search_index.js.gz +0 -0
- data/html/js/searcher.js +229 -0
- data/html/js/searcher.js.gz +0 -0
- data/html/table_of_contents.html +409 -0
- data/lib/hook/hookapp.rb +11 -12
- data/lib/hook/hooker.rb +1 -0
- data/lib/hook/markdown_document_listener.rb +12 -2
- data/lib/hook/prompt.rb +113 -0
- data/lib/hook/version.rb +1 -1
- data/lib/hook.rb +2 -0
- data/test/hook_clip_test.rb +1 -1
- data/test/hook_link_test.rb +2 -1
- data/test/hook_scripts_test.rb +1 -1
- metadata +82 -3
- data/lib/helpers/fuzzyfilefinder +0 -0
data/html/GLI.html
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
|
7
|
+
<title>module GLI - hookapp</title>
|
8
|
+
|
9
|
+
<script type="text/javascript">
|
10
|
+
var rdoc_rel_prefix = "./";
|
11
|
+
var index_rel_prefix = "./";
|
12
|
+
</script>
|
13
|
+
|
14
|
+
<script src="./js/navigation.js" defer></script>
|
15
|
+
<script src="./js/search.js" defer></script>
|
16
|
+
<script src="./js/search_index.js" defer></script>
|
17
|
+
<script src="./js/searcher.js" defer></script>
|
18
|
+
<script src="./js/darkfish.js" defer></script>
|
19
|
+
|
20
|
+
<link href="./css/fonts.css" rel="stylesheet">
|
21
|
+
<link href="./css/rdoc.css" rel="stylesheet">
|
22
|
+
|
23
|
+
|
24
|
+
<body id="top" role="document" class="module">
|
25
|
+
<nav role="navigation">
|
26
|
+
<div id="project-navigation">
|
27
|
+
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
28
|
+
<h2>
|
29
|
+
<a href="./index.html" rel="home">Home</a>
|
30
|
+
</h2>
|
31
|
+
|
32
|
+
<div id="table-of-contents-navigation">
|
33
|
+
<a href="./table_of_contents.html#pages">Pages</a>
|
34
|
+
<a href="./table_of_contents.html#classes">Classes</a>
|
35
|
+
<a href="./table_of_contents.html#methods">Methods</a>
|
36
|
+
</div>
|
37
|
+
</div>
|
38
|
+
|
39
|
+
<div id="search-section" role="search" class="project-section initially-hidden">
|
40
|
+
<form action="#" method="get" accept-charset="utf-8">
|
41
|
+
<div id="search-field-wrapper">
|
42
|
+
<input id="search-field" role="combobox" aria-label="Search"
|
43
|
+
aria-autocomplete="list" aria-controls="search-results"
|
44
|
+
type="text" name="search" placeholder="Search" spellcheck="false"
|
45
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
46
|
+
</div>
|
47
|
+
|
48
|
+
<ul id="search-results" aria-label="Search Results"
|
49
|
+
aria-busy="false" aria-expanded="false"
|
50
|
+
aria-atomic="false" class="initially-hidden"></ul>
|
51
|
+
</form>
|
52
|
+
</div>
|
53
|
+
|
54
|
+
</div>
|
55
|
+
|
56
|
+
|
57
|
+
|
58
|
+
<div id="class-metadata">
|
59
|
+
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
|
64
|
+
</div>
|
65
|
+
</nav>
|
66
|
+
|
67
|
+
<main role="main" aria-labelledby="module-GLI">
|
68
|
+
<h1 id="module-GLI" class="module">
|
69
|
+
module GLI
|
70
|
+
</h1>
|
71
|
+
|
72
|
+
<section class="description">
|
73
|
+
|
74
|
+
</section>
|
75
|
+
|
76
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
|
82
|
+
</section>
|
83
|
+
</main>
|
84
|
+
|
85
|
+
|
86
|
+
<footer id="validator-badges" role="contentinfo">
|
87
|
+
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
88
|
+
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.3.3.
|
89
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
90
|
+
</footer>
|
91
|
+
|
@@ -0,0 +1,100 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
|
7
|
+
<title>module Hook::Prompt - hookapp</title>
|
8
|
+
|
9
|
+
<script type="text/javascript">
|
10
|
+
var rdoc_rel_prefix = "../";
|
11
|
+
var index_rel_prefix = "../";
|
12
|
+
</script>
|
13
|
+
|
14
|
+
<script src="../js/navigation.js" defer></script>
|
15
|
+
<script src="../js/search.js" defer></script>
|
16
|
+
<script src="../js/search_index.js" defer></script>
|
17
|
+
<script src="../js/searcher.js" defer></script>
|
18
|
+
<script src="../js/darkfish.js" defer></script>
|
19
|
+
|
20
|
+
<link href="../css/fonts.css" rel="stylesheet">
|
21
|
+
<link href="../css/rdoc.css" rel="stylesheet">
|
22
|
+
|
23
|
+
|
24
|
+
<body id="top" role="document" class="module">
|
25
|
+
<nav role="navigation">
|
26
|
+
<div id="project-navigation">
|
27
|
+
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
28
|
+
<h2>
|
29
|
+
<a href="../index.html" rel="home">Home</a>
|
30
|
+
</h2>
|
31
|
+
|
32
|
+
<div id="table-of-contents-navigation">
|
33
|
+
<a href="../table_of_contents.html#pages">Pages</a>
|
34
|
+
<a href="../table_of_contents.html#classes">Classes</a>
|
35
|
+
<a href="../table_of_contents.html#methods">Methods</a>
|
36
|
+
</div>
|
37
|
+
</div>
|
38
|
+
|
39
|
+
<div id="search-section" role="search" class="project-section initially-hidden">
|
40
|
+
<form action="#" method="get" accept-charset="utf-8">
|
41
|
+
<div id="search-field-wrapper">
|
42
|
+
<input id="search-field" role="combobox" aria-label="Search"
|
43
|
+
aria-autocomplete="list" aria-controls="search-results"
|
44
|
+
type="text" name="search" placeholder="Search" spellcheck="false"
|
45
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
46
|
+
</div>
|
47
|
+
|
48
|
+
<ul id="search-results" aria-label="Search Results"
|
49
|
+
aria-busy="false" aria-expanded="false"
|
50
|
+
aria-atomic="false" class="initially-hidden"></ul>
|
51
|
+
</form>
|
52
|
+
</div>
|
53
|
+
|
54
|
+
</div>
|
55
|
+
|
56
|
+
|
57
|
+
|
58
|
+
<div id="class-metadata">
|
59
|
+
|
60
|
+
|
61
|
+
|
62
|
+
<div id="includes-section" class="nav-section">
|
63
|
+
<h3>Included Modules</h3>
|
64
|
+
|
65
|
+
<ul class="link-list">
|
66
|
+
<li><a class="include" href="PromptSTD.html">Hook::PromptSTD</a>
|
67
|
+
<li><a class="include" href="PromptFZF.html">Hook::PromptFZF</a>
|
68
|
+
</ul>
|
69
|
+
</div>
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
</div>
|
74
|
+
</nav>
|
75
|
+
|
76
|
+
<main role="main" aria-labelledby="module-Hook::Prompt">
|
77
|
+
<h1 id="module-Hook::Prompt" class="module">
|
78
|
+
module Hook::Prompt
|
79
|
+
</h1>
|
80
|
+
|
81
|
+
<section class="description">
|
82
|
+
|
83
|
+
</section>
|
84
|
+
|
85
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
</section>
|
92
|
+
</main>
|
93
|
+
|
94
|
+
|
95
|
+
<footer id="validator-badges" role="contentinfo">
|
96
|
+
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
97
|
+
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.3.3.
|
98
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
99
|
+
</footer>
|
100
|
+
|
@@ -0,0 +1,243 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
|
7
|
+
<title>module Hook::PromptFZF - hookapp</title>
|
8
|
+
|
9
|
+
<script type="text/javascript">
|
10
|
+
var rdoc_rel_prefix = "../";
|
11
|
+
var index_rel_prefix = "../";
|
12
|
+
</script>
|
13
|
+
|
14
|
+
<script src="../js/navigation.js" defer></script>
|
15
|
+
<script src="../js/search.js" defer></script>
|
16
|
+
<script src="../js/search_index.js" defer></script>
|
17
|
+
<script src="../js/searcher.js" defer></script>
|
18
|
+
<script src="../js/darkfish.js" defer></script>
|
19
|
+
|
20
|
+
<link href="../css/fonts.css" rel="stylesheet">
|
21
|
+
<link href="../css/rdoc.css" rel="stylesheet">
|
22
|
+
|
23
|
+
|
24
|
+
<body id="top" role="document" class="module">
|
25
|
+
<nav role="navigation">
|
26
|
+
<div id="project-navigation">
|
27
|
+
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
28
|
+
<h2>
|
29
|
+
<a href="../index.html" rel="home">Home</a>
|
30
|
+
</h2>
|
31
|
+
|
32
|
+
<div id="table-of-contents-navigation">
|
33
|
+
<a href="../table_of_contents.html#pages">Pages</a>
|
34
|
+
<a href="../table_of_contents.html#classes">Classes</a>
|
35
|
+
<a href="../table_of_contents.html#methods">Methods</a>
|
36
|
+
</div>
|
37
|
+
</div>
|
38
|
+
|
39
|
+
<div id="search-section" role="search" class="project-section initially-hidden">
|
40
|
+
<form action="#" method="get" accept-charset="utf-8">
|
41
|
+
<div id="search-field-wrapper">
|
42
|
+
<input id="search-field" role="combobox" aria-label="Search"
|
43
|
+
aria-autocomplete="list" aria-controls="search-results"
|
44
|
+
type="text" name="search" placeholder="Search" spellcheck="false"
|
45
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
46
|
+
</div>
|
47
|
+
|
48
|
+
<ul id="search-results" aria-label="Search Results"
|
49
|
+
aria-busy="false" aria-expanded="false"
|
50
|
+
aria-atomic="false" class="initially-hidden"></ul>
|
51
|
+
</form>
|
52
|
+
</div>
|
53
|
+
|
54
|
+
</div>
|
55
|
+
|
56
|
+
|
57
|
+
|
58
|
+
<div id="class-metadata">
|
59
|
+
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
|
64
|
+
<!-- Method Quickref -->
|
65
|
+
<div id="method-list-section" class="nav-section">
|
66
|
+
<h3>Methods</h3>
|
67
|
+
|
68
|
+
<ul class="link-list" role="directory">
|
69
|
+
<li ><a href="#method-i-fzf">#fzf</a>
|
70
|
+
<li ><a href="#method-i-install_fzf">#install_fzf</a>
|
71
|
+
<li ><a href="#method-i-uninstall_fzf">#uninstall_fzf</a>
|
72
|
+
<li ><a href="#method-i-which_fzf">#which_fzf</a>
|
73
|
+
</ul>
|
74
|
+
</div>
|
75
|
+
|
76
|
+
</div>
|
77
|
+
</nav>
|
78
|
+
|
79
|
+
<main role="main" aria-labelledby="module-Hook::PromptFZF">
|
80
|
+
<h1 id="module-Hook::PromptFZF" class="module">
|
81
|
+
module Hook::PromptFZF
|
82
|
+
</h1>
|
83
|
+
|
84
|
+
<section class="description">
|
85
|
+
|
86
|
+
<p>Methods for working installing/using FuzzyFileFinder</p>
|
87
|
+
|
88
|
+
</section>
|
89
|
+
|
90
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
97
|
+
<header>
|
98
|
+
<h3>Public Instance Methods</h3>
|
99
|
+
</header>
|
100
|
+
|
101
|
+
<div id="method-i-fzf" class="method-detail ">
|
102
|
+
<div class="method-heading">
|
103
|
+
<span class="method-name">fzf</span><span
|
104
|
+
class="method-args">()</span>
|
105
|
+
<span class="method-click-advice">click to toggle source</span>
|
106
|
+
</div>
|
107
|
+
|
108
|
+
<div class="method-description">
|
109
|
+
<p>Get path to fzf binary, installing if needed</p>
|
110
|
+
|
111
|
+
<p>@return [String] Path to fzf binary</p>
|
112
|
+
|
113
|
+
<div class="method-source-code" id="fzf-source">
|
114
|
+
<pre><span class="ruby-comment"># File lib/hook/prompt.rb, line 39</span>
|
115
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">fzf</span>
|
116
|
+
<span class="ruby-ivar">@fzf</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">install_fzf</span>
|
117
|
+
<span class="ruby-keyword">end</span></pre>
|
118
|
+
</div>
|
119
|
+
</div>
|
120
|
+
|
121
|
+
|
122
|
+
</div>
|
123
|
+
|
124
|
+
<div id="method-i-install_fzf" class="method-detail ">
|
125
|
+
<div class="method-heading">
|
126
|
+
<span class="method-name">install_fzf</span><span
|
127
|
+
class="method-args">(force: false)</span>
|
128
|
+
<span class="method-click-advice">click to toggle source</span>
|
129
|
+
</div>
|
130
|
+
|
131
|
+
<div class="method-description">
|
132
|
+
<p>Install fzf on the current system. Installs to a subdirectory of the gem</p>
|
133
|
+
|
134
|
+
<p>@param force [Boolean] If true, reinstall if</p>
|
135
|
+
|
136
|
+
<pre class="ruby"><span class="ruby-identifier">needed</span>
|
137
|
+
</pre>
|
138
|
+
|
139
|
+
<p>@return [String] Path to fzf binary</p>
|
140
|
+
|
141
|
+
<div class="method-source-code" id="install_fzf-source">
|
142
|
+
<pre><span class="ruby-comment"># File lib/hook/prompt.rb, line 74</span>
|
143
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">install_fzf</span>(<span class="ruby-value">force:</span> <span class="ruby-keyword">false</span>)
|
144
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">force</span>
|
145
|
+
<span class="ruby-identifier">uninstall_fzf</span>
|
146
|
+
<span class="ruby-keyword">elsif</span> <span class="ruby-identifier">which_fzf</span>
|
147
|
+
<span class="ruby-keyword">return</span> <span class="ruby-identifier">which_fzf</span>
|
148
|
+
<span class="ruby-keyword">end</span>
|
149
|
+
|
150
|
+
<span class="ruby-identifier">fzf_dir</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-keyword">__FILE__</span>), <span class="ruby-string">'../helpers/fzf'</span>)
|
151
|
+
<span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">mkdir_p</span>(<span class="ruby-identifier">fzf_dir</span>) <span class="ruby-keyword">unless</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">directory?</span>(<span class="ruby-identifier">fzf_dir</span>)
|
152
|
+
<span class="ruby-identifier">fzf_bin</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">fzf_dir</span>, <span class="ruby-string">'bin/fzf'</span>)
|
153
|
+
<span class="ruby-keyword">return</span> <span class="ruby-identifier">fzf_bin</span> <span class="ruby-keyword">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-identifier">fzf_bin</span>)
|
154
|
+
|
155
|
+
<span class="ruby-identifier">warn</span> <span class="ruby-string">'fzf: Compiling and installing fzf -- this will only happen once'</span>
|
156
|
+
<span class="ruby-identifier">warn</span> <span class="ruby-string">'fzf: fzf is copyright Junegunn Choi, MIT License <https://github.com/junegunn/fzf/blob/master/LICENSE>'</span>
|
157
|
+
|
158
|
+
<span class="ruby-identifier">silence_std</span>
|
159
|
+
<span class="ruby-node">`'#{fzf_dir}/install' --bin --no-key-bindings --no-completion --no-update-rc --no-bash --no-zsh --no-fish &> /dev/null`</span>
|
160
|
+
<span class="ruby-keyword">unless</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-identifier">fzf_bin</span>)
|
161
|
+
<span class="ruby-identifier">restore_std</span>
|
162
|
+
<span class="ruby-identifier">warn</span> <span class="ruby-string">'Error installing, trying again as root'</span>
|
163
|
+
<span class="ruby-identifier">silence_std</span>
|
164
|
+
<span class="ruby-node">`sudo '#{fzf_dir}/install' --bin --no-key-bindings --no-completion --no-update-rc --no-bash --no-zsh --no-fish &> /dev/null`</span>
|
165
|
+
<span class="ruby-keyword">end</span>
|
166
|
+
<span class="ruby-identifier">restore_std</span>
|
167
|
+
<span class="ruby-keyword">unless</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-identifier">fzf_bin</span>)
|
168
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-string">'fzf: unable to install fzf. You can install manually and Hook CLI will use the system version.'</span>
|
169
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-string">'fzf: see https://github.com/junegunn/fzf#installation'</span>
|
170
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">RuntimeError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">'Error installing fzf, please report at https://github.com/ttscoff/hookapp/issues'</span>)
|
171
|
+
<span class="ruby-keyword">end</span>
|
172
|
+
|
173
|
+
<span class="ruby-identifier">warn</span> <span class="ruby-node">"fzf: installed to #{fzf}"</span>
|
174
|
+
<span class="ruby-identifier">fzf_bin</span>
|
175
|
+
<span class="ruby-keyword">end</span></pre>
|
176
|
+
</div>
|
177
|
+
</div>
|
178
|
+
|
179
|
+
|
180
|
+
</div>
|
181
|
+
|
182
|
+
<div id="method-i-uninstall_fzf" class="method-detail ">
|
183
|
+
<div class="method-heading">
|
184
|
+
<span class="method-name">uninstall_fzf</span><span
|
185
|
+
class="method-args">()</span>
|
186
|
+
<span class="method-click-advice">click to toggle source</span>
|
187
|
+
</div>
|
188
|
+
|
189
|
+
<div class="method-description">
|
190
|
+
<p>Remove fzf binary</p>
|
191
|
+
|
192
|
+
<div class="method-source-code" id="uninstall_fzf-source">
|
193
|
+
<pre><span class="ruby-comment"># File lib/hook/prompt.rb, line 46</span>
|
194
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">uninstall_fzf</span>
|
195
|
+
<span class="ruby-identifier">fzf_bin</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-keyword">__FILE__</span>), <span class="ruby-string">'../helpers/fzf/bin/fzf'</span>)
|
196
|
+
<span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">rm_f</span>(<span class="ruby-identifier">fzf_bin</span>) <span class="ruby-keyword">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-identifier">fzf_bin</span>)
|
197
|
+
<span class="ruby-identifier">warn</span> <span class="ruby-string">'fzf: removed #{fzf_bin}'</span>
|
198
|
+
<span class="ruby-keyword">end</span></pre>
|
199
|
+
</div>
|
200
|
+
</div>
|
201
|
+
|
202
|
+
|
203
|
+
</div>
|
204
|
+
|
205
|
+
<div id="method-i-which_fzf" class="method-detail ">
|
206
|
+
<div class="method-heading">
|
207
|
+
<span class="method-name">which_fzf</span><span
|
208
|
+
class="method-args">()</span>
|
209
|
+
<span class="method-click-advice">click to toggle source</span>
|
210
|
+
</div>
|
211
|
+
|
212
|
+
<div class="method-description">
|
213
|
+
<p>Return the path to the fzf binary</p>
|
214
|
+
|
215
|
+
<p>@return [String] Path to fzf</p>
|
216
|
+
|
217
|
+
<div class="method-source-code" id="which_fzf-source">
|
218
|
+
<pre><span class="ruby-comment"># File lib/hook/prompt.rb, line 57</span>
|
219
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">which_fzf</span>
|
220
|
+
<span class="ruby-identifier">fzf_dir</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-keyword">__FILE__</span>), <span class="ruby-string">'../helpers/fzf'</span>)
|
221
|
+
<span class="ruby-identifier">fzf_bin</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">fzf_dir</span>, <span class="ruby-string">'bin/fzf'</span>)
|
222
|
+
<span class="ruby-keyword">return</span> <span class="ruby-identifier">fzf_bin</span> <span class="ruby-keyword">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-identifier">fzf_bin</span>)
|
223
|
+
|
224
|
+
<span class="ruby-constant">TTY</span><span class="ruby-operator">::</span><span class="ruby-constant">Which</span>.<span class="ruby-identifier">which</span>(<span class="ruby-string">'fzf'</span>)
|
225
|
+
<span class="ruby-keyword">end</span></pre>
|
226
|
+
</div>
|
227
|
+
</div>
|
228
|
+
|
229
|
+
|
230
|
+
</div>
|
231
|
+
|
232
|
+
</section>
|
233
|
+
|
234
|
+
</section>
|
235
|
+
</main>
|
236
|
+
|
237
|
+
|
238
|
+
<footer id="validator-badges" role="contentinfo">
|
239
|
+
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
240
|
+
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.3.3.
|
241
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
242
|
+
</footer>
|
243
|
+
|
@@ -0,0 +1,177 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
|
7
|
+
<title>module Hook::PromptSTD - hookapp</title>
|
8
|
+
|
9
|
+
<script type="text/javascript">
|
10
|
+
var rdoc_rel_prefix = "../";
|
11
|
+
var index_rel_prefix = "../";
|
12
|
+
</script>
|
13
|
+
|
14
|
+
<script src="../js/navigation.js" defer></script>
|
15
|
+
<script src="../js/search.js" defer></script>
|
16
|
+
<script src="../js/search_index.js" defer></script>
|
17
|
+
<script src="../js/searcher.js" defer></script>
|
18
|
+
<script src="../js/darkfish.js" defer></script>
|
19
|
+
|
20
|
+
<link href="../css/fonts.css" rel="stylesheet">
|
21
|
+
<link href="../css/rdoc.css" rel="stylesheet">
|
22
|
+
|
23
|
+
|
24
|
+
<body id="top" role="document" class="module">
|
25
|
+
<nav role="navigation">
|
26
|
+
<div id="project-navigation">
|
27
|
+
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
28
|
+
<h2>
|
29
|
+
<a href="../index.html" rel="home">Home</a>
|
30
|
+
</h2>
|
31
|
+
|
32
|
+
<div id="table-of-contents-navigation">
|
33
|
+
<a href="../table_of_contents.html#pages">Pages</a>
|
34
|
+
<a href="../table_of_contents.html#classes">Classes</a>
|
35
|
+
<a href="../table_of_contents.html#methods">Methods</a>
|
36
|
+
</div>
|
37
|
+
</div>
|
38
|
+
|
39
|
+
<div id="search-section" role="search" class="project-section initially-hidden">
|
40
|
+
<form action="#" method="get" accept-charset="utf-8">
|
41
|
+
<div id="search-field-wrapper">
|
42
|
+
<input id="search-field" role="combobox" aria-label="Search"
|
43
|
+
aria-autocomplete="list" aria-controls="search-results"
|
44
|
+
type="text" name="search" placeholder="Search" spellcheck="false"
|
45
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
46
|
+
</div>
|
47
|
+
|
48
|
+
<ul id="search-results" aria-label="Search Results"
|
49
|
+
aria-busy="false" aria-expanded="false"
|
50
|
+
aria-atomic="false" class="initially-hidden"></ul>
|
51
|
+
</form>
|
52
|
+
</div>
|
53
|
+
|
54
|
+
</div>
|
55
|
+
|
56
|
+
|
57
|
+
|
58
|
+
<div id="class-metadata">
|
59
|
+
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
|
64
|
+
<!-- Method Quickref -->
|
65
|
+
<div id="method-list-section" class="nav-section">
|
66
|
+
<h3>Methods</h3>
|
67
|
+
|
68
|
+
<ul class="link-list" role="directory">
|
69
|
+
<li ><a href="#method-i-clear_screen">#clear_screen</a>
|
70
|
+
<li ><a href="#method-i-restore_std">#restore_std</a>
|
71
|
+
<li ><a href="#method-i-silence_std">#silence_std</a>
|
72
|
+
</ul>
|
73
|
+
</div>
|
74
|
+
|
75
|
+
</div>
|
76
|
+
</nav>
|
77
|
+
|
78
|
+
<main role="main" aria-labelledby="module-Hook::PromptSTD">
|
79
|
+
<h1 id="module-Hook::PromptSTD" class="module">
|
80
|
+
module Hook::PromptSTD
|
81
|
+
</h1>
|
82
|
+
|
83
|
+
<section class="description">
|
84
|
+
|
85
|
+
</section>
|
86
|
+
|
87
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
94
|
+
<header>
|
95
|
+
<h3>Public Instance Methods</h3>
|
96
|
+
</header>
|
97
|
+
|
98
|
+
<div id="method-i-clear_screen" class="method-detail ">
|
99
|
+
<div class="method-heading">
|
100
|
+
<span class="method-name">clear_screen</span><span
|
101
|
+
class="method-args">(msg = nil)</span>
|
102
|
+
<span class="method-click-advice">click to toggle source</span>
|
103
|
+
</div>
|
104
|
+
|
105
|
+
<div class="method-description">
|
106
|
+
<p>Clear the terminal screen</p>
|
107
|
+
|
108
|
+
<div class="method-source-code" id="clear_screen-source">
|
109
|
+
<pre><span class="ruby-comment"># File lib/hook/prompt.rb, line 8</span>
|
110
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">clear_screen</span>(<span class="ruby-identifier">msg</span> = <span class="ruby-keyword">nil</span>)
|
111
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-string">"\e[H\e[2J"</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">$stdout</span>.<span class="ruby-identifier">tty?</span>
|
112
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-identifier">msg</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">msg</span>.<span class="ruby-identifier">good?</span>
|
113
|
+
<span class="ruby-keyword">end</span></pre>
|
114
|
+
</div>
|
115
|
+
</div>
|
116
|
+
|
117
|
+
|
118
|
+
</div>
|
119
|
+
|
120
|
+
<div id="method-i-restore_std" class="method-detail ">
|
121
|
+
<div class="method-heading">
|
122
|
+
<span class="method-name">restore_std</span><span
|
123
|
+
class="method-args">()</span>
|
124
|
+
<span class="method-click-advice">click to toggle source</span>
|
125
|
+
</div>
|
126
|
+
|
127
|
+
<div class="method-description">
|
128
|
+
<p>Restore silenced STDOUT and STDERR</p>
|
129
|
+
|
130
|
+
<div class="method-source-code" id="restore_std-source">
|
131
|
+
<pre><span class="ruby-comment"># File lib/hook/prompt.rb, line 26</span>
|
132
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">restore_std</span>
|
133
|
+
<span class="ruby-identifier">$stdout</span> = <span class="ruby-constant">STDOUT</span>
|
134
|
+
<span class="ruby-identifier">$stderr</span> = <span class="ruby-constant">STDERR</span>
|
135
|
+
<span class="ruby-keyword">end</span></pre>
|
136
|
+
</div>
|
137
|
+
</div>
|
138
|
+
|
139
|
+
|
140
|
+
</div>
|
141
|
+
|
142
|
+
<div id="method-i-silence_std" class="method-detail ">
|
143
|
+
<div class="method-heading">
|
144
|
+
<span class="method-name">silence_std</span><span
|
145
|
+
class="method-args">(file = '/dev/null')</span>
|
146
|
+
<span class="method-click-advice">click to toggle source</span>
|
147
|
+
</div>
|
148
|
+
|
149
|
+
<div class="method-description">
|
150
|
+
<p>Redirect STDOUT and STDERR to /dev/null or file</p>
|
151
|
+
|
152
|
+
<p>@param file [String] a file path to redirect to</p>
|
153
|
+
|
154
|
+
<div class="method-source-code" id="silence_std-source">
|
155
|
+
<pre><span class="ruby-comment"># File lib/hook/prompt.rb, line 18</span>
|
156
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">silence_std</span>(<span class="ruby-identifier">file</span> = <span class="ruby-string">'/dev/null'</span>)
|
157
|
+
<span class="ruby-identifier">$stdout</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">file</span>, <span class="ruby-string">'w'</span>)
|
158
|
+
<span class="ruby-identifier">$stderr</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">file</span>, <span class="ruby-string">'w'</span>)
|
159
|
+
<span class="ruby-keyword">end</span></pre>
|
160
|
+
</div>
|
161
|
+
</div>
|
162
|
+
|
163
|
+
|
164
|
+
</div>
|
165
|
+
|
166
|
+
</section>
|
167
|
+
|
168
|
+
</section>
|
169
|
+
</main>
|
170
|
+
|
171
|
+
|
172
|
+
<footer id="validator-badges" role="contentinfo">
|
173
|
+
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
174
|
+
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.3.3.
|
175
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
176
|
+
</footer>
|
177
|
+
|