hookapp 0.0.7 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/CHANGELOG.md +14 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +2 -2
- data/LICENSE.md +31 -0
- data/OVERVIEW.md +80 -0
- data/README.md +282 -21
- data/Rakefile +1 -1
- data/bin/hook +127 -10
- data/buildnotes.md +29 -0
- data/hook.rdoc +63 -4
- data/hookapp.gemspec +9 -8
- data/html/App.html +119 -0
- data/html/GLI.html +99 -0
- data/html/GLI/Commands.html +99 -0
- data/html/GLI/Commands/Doc.html +99 -0
- data/html/GLI/Commands/MarkdownDocumentListener.html +717 -0
- data/html/Hook.html +113 -0
- data/html/HookApp.html +1222 -0
- data/html/Hooker.html +119 -0
- data/html/README_rdoc.html +328 -0
- data/html/String.html +427 -0
- data/html/created.rid +9 -0
- data/html/css/fonts.css +167 -0
- data/html/css/rdoc.css +619 -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 +308 -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/completion/hook_completion.bash +22 -0
- data/lib/completion/hook_completion.fish +31 -0
- data/lib/completion/hook_completion.zsh +22 -0
- data/lib/helpers/fuzzyfilefinder +0 -0
- data/lib/hook.rb +5 -1
- data/lib/hook/hookapp.rb +489 -0
- data/lib/hook/hooker.rb +1 -344
- data/lib/hook/markdown_document_listener.rb +164 -0
- data/lib/hook/string.rb +60 -0
- data/lib/hook/version.rb +3 -1
- metadata +76 -12
data/html/GLI.html
ADDED
@@ -0,0 +1,99 @@
|
|
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
|
+
|
25
|
+
|
26
|
+
<body id="top" role="document" class="module">
|
27
|
+
<nav role="navigation">
|
28
|
+
<div id="project-navigation">
|
29
|
+
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
30
|
+
<h2>
|
31
|
+
<a href="./index.html" rel="home">Home</a>
|
32
|
+
</h2>
|
33
|
+
|
34
|
+
<div id="table-of-contents-navigation">
|
35
|
+
<a href="./table_of_contents.html#pages">Pages</a>
|
36
|
+
<a href="./table_of_contents.html#classes">Classes</a>
|
37
|
+
<a href="./table_of_contents.html#methods">Methods</a>
|
38
|
+
</div>
|
39
|
+
</div>
|
40
|
+
|
41
|
+
<div id="search-section" role="search" class="project-section initially-hidden">
|
42
|
+
<form action="#" method="get" accept-charset="utf-8">
|
43
|
+
<div id="search-field-wrapper">
|
44
|
+
<input id="search-field" role="combobox" aria-label="Search"
|
45
|
+
aria-autocomplete="list" aria-controls="search-results"
|
46
|
+
type="text" name="search" placeholder="Search" spellcheck="false"
|
47
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
48
|
+
</div>
|
49
|
+
|
50
|
+
<ul id="search-results" aria-label="Search Results"
|
51
|
+
aria-busy="false" aria-expanded="false"
|
52
|
+
aria-atomic="false" class="initially-hidden"></ul>
|
53
|
+
</form>
|
54
|
+
</div>
|
55
|
+
|
56
|
+
</div>
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
<div id="class-metadata">
|
61
|
+
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
</div>
|
67
|
+
</nav>
|
68
|
+
|
69
|
+
<main role="main" aria-labelledby="module-GLI">
|
70
|
+
<h1 id="module-GLI" class="module">
|
71
|
+
module GLI
|
72
|
+
</h1>
|
73
|
+
|
74
|
+
<section class="description">
|
75
|
+
|
76
|
+
</section>
|
77
|
+
|
78
|
+
|
79
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
</section>
|
90
|
+
|
91
|
+
</main>
|
92
|
+
|
93
|
+
|
94
|
+
<footer id="validator-badges" role="contentinfo">
|
95
|
+
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
96
|
+
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.2.1.
|
97
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
98
|
+
</footer>
|
99
|
+
|
@@ -0,0 +1,99 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
|
7
|
+
<title>module GLI::Commands - 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
|
+
|
25
|
+
|
26
|
+
<body id="top" role="document" class="module">
|
27
|
+
<nav role="navigation">
|
28
|
+
<div id="project-navigation">
|
29
|
+
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
30
|
+
<h2>
|
31
|
+
<a href="../index.html" rel="home">Home</a>
|
32
|
+
</h2>
|
33
|
+
|
34
|
+
<div id="table-of-contents-navigation">
|
35
|
+
<a href="../table_of_contents.html#pages">Pages</a>
|
36
|
+
<a href="../table_of_contents.html#classes">Classes</a>
|
37
|
+
<a href="../table_of_contents.html#methods">Methods</a>
|
38
|
+
</div>
|
39
|
+
</div>
|
40
|
+
|
41
|
+
<div id="search-section" role="search" class="project-section initially-hidden">
|
42
|
+
<form action="#" method="get" accept-charset="utf-8">
|
43
|
+
<div id="search-field-wrapper">
|
44
|
+
<input id="search-field" role="combobox" aria-label="Search"
|
45
|
+
aria-autocomplete="list" aria-controls="search-results"
|
46
|
+
type="text" name="search" placeholder="Search" spellcheck="false"
|
47
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
48
|
+
</div>
|
49
|
+
|
50
|
+
<ul id="search-results" aria-label="Search Results"
|
51
|
+
aria-busy="false" aria-expanded="false"
|
52
|
+
aria-atomic="false" class="initially-hidden"></ul>
|
53
|
+
</form>
|
54
|
+
</div>
|
55
|
+
|
56
|
+
</div>
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
<div id="class-metadata">
|
61
|
+
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
</div>
|
67
|
+
</nav>
|
68
|
+
|
69
|
+
<main role="main" aria-labelledby="module-GLI::Commands">
|
70
|
+
<h1 id="module-GLI::Commands" class="module">
|
71
|
+
module GLI::Commands
|
72
|
+
</h1>
|
73
|
+
|
74
|
+
<section class="description">
|
75
|
+
|
76
|
+
</section>
|
77
|
+
|
78
|
+
|
79
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
</section>
|
90
|
+
|
91
|
+
</main>
|
92
|
+
|
93
|
+
|
94
|
+
<footer id="validator-badges" role="contentinfo">
|
95
|
+
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
96
|
+
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.2.1.
|
97
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
98
|
+
</footer>
|
99
|
+
|
@@ -0,0 +1,99 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
|
7
|
+
<title>module GLI::Commands::Doc - 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
|
+
|
25
|
+
|
26
|
+
<body id="top" role="document" class="module">
|
27
|
+
<nav role="navigation">
|
28
|
+
<div id="project-navigation">
|
29
|
+
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
30
|
+
<h2>
|
31
|
+
<a href="../../index.html" rel="home">Home</a>
|
32
|
+
</h2>
|
33
|
+
|
34
|
+
<div id="table-of-contents-navigation">
|
35
|
+
<a href="../../table_of_contents.html#pages">Pages</a>
|
36
|
+
<a href="../../table_of_contents.html#classes">Classes</a>
|
37
|
+
<a href="../../table_of_contents.html#methods">Methods</a>
|
38
|
+
</div>
|
39
|
+
</div>
|
40
|
+
|
41
|
+
<div id="search-section" role="search" class="project-section initially-hidden">
|
42
|
+
<form action="#" method="get" accept-charset="utf-8">
|
43
|
+
<div id="search-field-wrapper">
|
44
|
+
<input id="search-field" role="combobox" aria-label="Search"
|
45
|
+
aria-autocomplete="list" aria-controls="search-results"
|
46
|
+
type="text" name="search" placeholder="Search" spellcheck="false"
|
47
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
48
|
+
</div>
|
49
|
+
|
50
|
+
<ul id="search-results" aria-label="Search Results"
|
51
|
+
aria-busy="false" aria-expanded="false"
|
52
|
+
aria-atomic="false" class="initially-hidden"></ul>
|
53
|
+
</form>
|
54
|
+
</div>
|
55
|
+
|
56
|
+
</div>
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
<div id="class-metadata">
|
61
|
+
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
</div>
|
67
|
+
</nav>
|
68
|
+
|
69
|
+
<main role="main" aria-labelledby="module-GLI::Commands::Doc">
|
70
|
+
<h1 id="module-GLI::Commands::Doc" class="module">
|
71
|
+
module GLI::Commands::Doc
|
72
|
+
</h1>
|
73
|
+
|
74
|
+
<section class="description">
|
75
|
+
|
76
|
+
</section>
|
77
|
+
|
78
|
+
|
79
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
</section>
|
90
|
+
|
91
|
+
</main>
|
92
|
+
|
93
|
+
|
94
|
+
<footer id="validator-badges" role="contentinfo">
|
95
|
+
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
96
|
+
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.2.1.
|
97
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
98
|
+
</footer>
|
99
|
+
|
@@ -0,0 +1,717 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
|
7
|
+
<title>class GLI::Commands::MarkdownDocumentListener - 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
|
+
|
25
|
+
|
26
|
+
<body id="top" role="document" class="class">
|
27
|
+
<nav role="navigation">
|
28
|
+
<div id="project-navigation">
|
29
|
+
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
30
|
+
<h2>
|
31
|
+
<a href="../../index.html" rel="home">Home</a>
|
32
|
+
</h2>
|
33
|
+
|
34
|
+
<div id="table-of-contents-navigation">
|
35
|
+
<a href="../../table_of_contents.html#pages">Pages</a>
|
36
|
+
<a href="../../table_of_contents.html#classes">Classes</a>
|
37
|
+
<a href="../../table_of_contents.html#methods">Methods</a>
|
38
|
+
</div>
|
39
|
+
</div>
|
40
|
+
|
41
|
+
<div id="search-section" role="search" class="project-section initially-hidden">
|
42
|
+
<form action="#" method="get" accept-charset="utf-8">
|
43
|
+
<div id="search-field-wrapper">
|
44
|
+
<input id="search-field" role="combobox" aria-label="Search"
|
45
|
+
aria-autocomplete="list" aria-controls="search-results"
|
46
|
+
type="text" name="search" placeholder="Search" spellcheck="false"
|
47
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
48
|
+
</div>
|
49
|
+
|
50
|
+
<ul id="search-results" aria-label="Search Results"
|
51
|
+
aria-busy="false" aria-expanded="false"
|
52
|
+
aria-atomic="false" class="initially-hidden"></ul>
|
53
|
+
</form>
|
54
|
+
</div>
|
55
|
+
|
56
|
+
</div>
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
<div id="class-metadata">
|
61
|
+
|
62
|
+
<div id="parent-class-section" class="nav-section">
|
63
|
+
<h3>Parent</h3>
|
64
|
+
|
65
|
+
|
66
|
+
<p class="link">Object
|
67
|
+
|
68
|
+
</div>
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
<!-- Method Quickref -->
|
73
|
+
<div id="method-list-section" class="nav-section">
|
74
|
+
<h3>Methods</h3>
|
75
|
+
|
76
|
+
<ul class="link-list" role="directory">
|
77
|
+
|
78
|
+
<li ><a href="#method-c-new">::new</a>
|
79
|
+
|
80
|
+
<li ><a href="#method-i-beginning">#beginning</a>
|
81
|
+
|
82
|
+
<li ><a href="#method-i-command">#command</a>
|
83
|
+
|
84
|
+
<li ><a href="#method-i-commands">#commands</a>
|
85
|
+
|
86
|
+
<li ><a href="#method-i-default_command">#default_command</a>
|
87
|
+
|
88
|
+
<li ><a href="#method-i-end_command">#end_command</a>
|
89
|
+
|
90
|
+
<li ><a href="#method-i-end_commands">#end_commands</a>
|
91
|
+
|
92
|
+
<li ><a href="#method-i-end_options">#end_options</a>
|
93
|
+
|
94
|
+
<li ><a href="#method-i-ending">#ending</a>
|
95
|
+
|
96
|
+
<li ><a href="#method-i-flag">#flag</a>
|
97
|
+
|
98
|
+
<li ><a href="#method-i-options">#options</a>
|
99
|
+
|
100
|
+
<li ><a href="#method-i-program_desc">#program_desc</a>
|
101
|
+
|
102
|
+
<li ><a href="#method-i-program_long_desc">#program_long_desc</a>
|
103
|
+
|
104
|
+
<li ><a href="#method-i-switch">#switch</a>
|
105
|
+
|
106
|
+
<li ><a href="#method-i-version">#version</a>
|
107
|
+
|
108
|
+
</ul>
|
109
|
+
</div>
|
110
|
+
|
111
|
+
</div>
|
112
|
+
</nav>
|
113
|
+
|
114
|
+
<main role="main" aria-labelledby="class-GLI::Commands::MarkdownDocumentListener">
|
115
|
+
<h1 id="class-GLI::Commands::MarkdownDocumentListener" class="class">
|
116
|
+
class GLI::Commands::MarkdownDocumentListener
|
117
|
+
</h1>
|
118
|
+
|
119
|
+
<section class="description">
|
120
|
+
|
121
|
+
<p>DocumentListener class for <a href="../../GLI.html"><code>GLI</code></a> documentation generator</p>
|
122
|
+
|
123
|
+
</section>
|
124
|
+
|
125
|
+
|
126
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
|
136
|
+
<section id="public-class-5Buntitled-5D-method-details" class="method-section">
|
137
|
+
<header>
|
138
|
+
<h3>Public Class Methods</h3>
|
139
|
+
</header>
|
140
|
+
|
141
|
+
|
142
|
+
<div id="method-c-new" class="method-detail ">
|
143
|
+
|
144
|
+
<div class="method-heading">
|
145
|
+
<span class="method-name">new</span><span
|
146
|
+
class="method-args">(_global_options, _options, _arguments, app)</span>
|
147
|
+
|
148
|
+
<span class="method-click-advice">click to toggle source</span>
|
149
|
+
|
150
|
+
</div>
|
151
|
+
|
152
|
+
|
153
|
+
<div class="method-description">
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
<div class="method-source-code" id="new-source">
|
161
|
+
<pre><span class="ruby-comment"># File lib/hook/markdown_document_listener.rb, line 9</span>
|
162
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>(<span class="ruby-identifier">_global_options</span>, <span class="ruby-identifier">_options</span>, <span class="ruby-identifier">_arguments</span>, <span class="ruby-identifier">app</span>)
|
163
|
+
<span class="ruby-ivar">@exe</span> = <span class="ruby-identifier">app</span>.<span class="ruby-identifier">exe_name</span>
|
164
|
+
<span class="ruby-keyword">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-string">'README.md'</span>) <span class="ruby-comment"># Back up existing README</span>
|
165
|
+
<span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">mv</span>(<span class="ruby-string">'README.md'</span>, <span class="ruby-string">'README.bak'</span>)
|
166
|
+
<span class="ruby-identifier">$stderr</span>.<span class="ruby-identifier">puts</span> <span class="ruby-string">"Backing up existing README.md to README.bak"</span>
|
167
|
+
<span class="ruby-keyword">end</span>
|
168
|
+
<span class="ruby-ivar">@io</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">'README.md'</span>, <span class="ruby-string">'w'</span>)
|
169
|
+
<span class="ruby-ivar">@nest</span> = <span class="ruby-string">'#'</span>
|
170
|
+
<span class="ruby-ivar">@arg_name_formatter</span> = <span class="ruby-constant">GLI</span><span class="ruby-operator">::</span><span class="ruby-constant">Commands</span><span class="ruby-operator">::</span><span class="ruby-constant">HelpModules</span><span class="ruby-operator">::</span><span class="ruby-constant">ArgNameFormatter</span>.<span class="ruby-identifier">new</span>
|
171
|
+
<span class="ruby-keyword">end</span></pre>
|
172
|
+
</div>
|
173
|
+
|
174
|
+
</div>
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
</div>
|
180
|
+
|
181
|
+
|
182
|
+
</section>
|
183
|
+
|
184
|
+
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
185
|
+
<header>
|
186
|
+
<h3>Public Instance Methods</h3>
|
187
|
+
</header>
|
188
|
+
|
189
|
+
|
190
|
+
<div id="method-i-beginning" class="method-detail ">
|
191
|
+
|
192
|
+
<div class="method-heading">
|
193
|
+
<span class="method-name">beginning</span><span
|
194
|
+
class="method-args">()</span>
|
195
|
+
|
196
|
+
<span class="method-click-advice">click to toggle source</span>
|
197
|
+
|
198
|
+
</div>
|
199
|
+
|
200
|
+
|
201
|
+
<div class="method-description">
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
|
208
|
+
<div class="method-source-code" id="beginning-source">
|
209
|
+
<pre><span class="ruby-comment"># File lib/hook/markdown_document_listener.rb, line 20</span>
|
210
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">beginning</span>
|
211
|
+
<span class="ruby-keyword">end</span></pre>
|
212
|
+
</div>
|
213
|
+
|
214
|
+
</div>
|
215
|
+
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
</div>
|
220
|
+
|
221
|
+
|
222
|
+
<div id="method-i-command" class="method-detail ">
|
223
|
+
|
224
|
+
<div class="method-heading">
|
225
|
+
<span class="method-name">command</span><span
|
226
|
+
class="method-args">(name, aliases, desc, long_desc, arg_name, arg_options)</span>
|
227
|
+
|
228
|
+
<span class="method-click-advice">click to toggle source</span>
|
229
|
+
|
230
|
+
</div>
|
231
|
+
|
232
|
+
|
233
|
+
<div class="method-description">
|
234
|
+
|
235
|
+
<p>Gives you a command in the current context and creates a new context of this command</p>
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
|
240
|
+
<div class="method-source-code" id="command-source">
|
241
|
+
<pre><span class="ruby-comment"># File lib/hook/markdown_document_listener.rb, line 111</span>
|
242
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">command</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">aliases</span>, <span class="ruby-identifier">desc</span>, <span class="ruby-identifier">long_desc</span>, <span class="ruby-identifier">arg_name</span>, <span class="ruby-identifier">arg_options</span>)
|
243
|
+
<span class="ruby-identifier">arg_name_fmt</span> = <span class="ruby-ivar">@arg_name_formatter</span>.<span class="ruby-identifier">format</span>(<span class="ruby-identifier">arg_name</span>, <span class="ruby-identifier">arg_options</span>, [])
|
244
|
+
<span class="ruby-ivar">@io</span>.<span class="ruby-identifier">puts</span> <span class="ruby-identifier">header</span>(<span class="ruby-node">"`$ #{@exe}` <mark>`#{([name] + aliases).join('|')}`</mark> `#{arg_name_fmt}`"</span>, <span class="ruby-value">1</span>)
|
245
|
+
<span class="ruby-ivar">@io</span>.<span class="ruby-identifier">puts</span>
|
246
|
+
<span class="ruby-ivar">@io</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">"*#{String(desc).strip}*"</span>
|
247
|
+
<span class="ruby-ivar">@io</span>.<span class="ruby-identifier">puts</span>
|
248
|
+
<span class="ruby-identifier">cmd_desc</span> = <span class="ruby-constant">String</span>(<span class="ruby-identifier">long_desc</span>).<span class="ruby-identifier">strip</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">"\n"</span>).<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">_</span><span class="ruby-operator">|</span> <span class="ruby-node">"> #{_}"</span> }.<span class="ruby-identifier">join</span>(<span class="ruby-string">"\n"</span>)
|
249
|
+
<span class="ruby-ivar">@io</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">"#{cmd_desc}\n\n"</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">cmd_desc</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
|
250
|
+
<span class="ruby-identifier">increment_nest</span>
|
251
|
+
<span class="ruby-keyword">end</span></pre>
|
252
|
+
</div>
|
253
|
+
|
254
|
+
</div>
|
255
|
+
|
256
|
+
|
257
|
+
|
258
|
+
|
259
|
+
</div>
|
260
|
+
|
261
|
+
|
262
|
+
<div id="method-i-commands" class="method-detail ">
|
263
|
+
|
264
|
+
<div class="method-heading">
|
265
|
+
<span class="method-name">commands</span><span
|
266
|
+
class="method-args">()</span>
|
267
|
+
|
268
|
+
<span class="method-click-advice">click to toggle source</span>
|
269
|
+
|
270
|
+
</div>
|
271
|
+
|
272
|
+
|
273
|
+
<div class="method-description">
|
274
|
+
|
275
|
+
|
276
|
+
|
277
|
+
|
278
|
+
|
279
|
+
|
280
|
+
<div class="method-source-code" id="commands-source">
|
281
|
+
<pre><span class="ruby-comment"># File lib/hook/markdown_document_listener.rb, line 104</span>
|
282
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">commands</span>
|
283
|
+
<span class="ruby-ivar">@io</span>.<span class="ruby-identifier">puts</span> <span class="ruby-identifier">header</span>(<span class="ruby-string">"Commands"</span>, <span class="ruby-value">1</span>)
|
284
|
+
<span class="ruby-ivar">@io</span>.<span class="ruby-identifier">puts</span>
|
285
|
+
<span class="ruby-identifier">increment_nest</span>
|
286
|
+
<span class="ruby-keyword">end</span></pre>
|
287
|
+
</div>
|
288
|
+
|
289
|
+
</div>
|
290
|
+
|
291
|
+
|
292
|
+
|
293
|
+
|
294
|
+
</div>
|
295
|
+
|
296
|
+
|
297
|
+
<div id="method-i-default_command" class="method-detail ">
|
298
|
+
|
299
|
+
<div class="method-heading">
|
300
|
+
<span class="method-name">default_command</span><span
|
301
|
+
class="method-args">(name)</span>
|
302
|
+
|
303
|
+
<span class="method-click-advice">click to toggle source</span>
|
304
|
+
|
305
|
+
</div>
|
306
|
+
|
307
|
+
|
308
|
+
<div class="method-description">
|
309
|
+
|
310
|
+
<p>Gives you the name of the current command in the current context</p>
|
311
|
+
|
312
|
+
|
313
|
+
|
314
|
+
|
315
|
+
<div class="method-source-code" id="default_command-source">
|
316
|
+
<pre><span class="ruby-comment"># File lib/hook/markdown_document_listener.rb, line 129</span>
|
317
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">default_command</span>(<span class="ruby-identifier">name</span>)
|
318
|
+
<span class="ruby-ivar">@io</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">"#### [Default Command] #{name}"</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">name</span>.<span class="ruby-identifier">nil?</span>
|
319
|
+
<span class="ruby-keyword">end</span></pre>
|
320
|
+
</div>
|
321
|
+
|
322
|
+
</div>
|
323
|
+
|
324
|
+
|
325
|
+
|
326
|
+
|
327
|
+
</div>
|
328
|
+
|
329
|
+
|
330
|
+
<div id="method-i-end_command" class="method-detail ">
|
331
|
+
|
332
|
+
<div class="method-heading">
|
333
|
+
<span class="method-name">end_command</span><span
|
334
|
+
class="method-args">(_name)</span>
|
335
|
+
|
336
|
+
<span class="method-click-advice">click to toggle source</span>
|
337
|
+
|
338
|
+
</div>
|
339
|
+
|
340
|
+
|
341
|
+
<div class="method-description">
|
342
|
+
|
343
|
+
<p>Ends a command, and “pops” you back up one context</p>
|
344
|
+
|
345
|
+
|
346
|
+
|
347
|
+
|
348
|
+
<div class="method-source-code" id="end_command-source">
|
349
|
+
<pre><span class="ruby-comment"># File lib/hook/markdown_document_listener.rb, line 123</span>
|
350
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">end_command</span>(<span class="ruby-identifier">_name</span>)
|
351
|
+
<span class="ruby-identifier">decrement_nest</span>
|
352
|
+
<span class="ruby-ivar">@io</span>.<span class="ruby-identifier">puts</span> <span class="ruby-string">"* * * * * *\n\n"</span> <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@nest</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">></span> <span class="ruby-value">2</span>
|
353
|
+
<span class="ruby-keyword">end</span></pre>
|
354
|
+
</div>
|
355
|
+
|
356
|
+
</div>
|
357
|
+
|
358
|
+
|
359
|
+
|
360
|
+
|
361
|
+
</div>
|
362
|
+
|
363
|
+
|
364
|
+
<div id="method-i-end_commands" class="method-detail ">
|
365
|
+
|
366
|
+
<div class="method-heading">
|
367
|
+
<span class="method-name">end_commands</span><span
|
368
|
+
class="method-args">()</span>
|
369
|
+
|
370
|
+
<span class="method-click-advice">click to toggle source</span>
|
371
|
+
|
372
|
+
</div>
|
373
|
+
|
374
|
+
|
375
|
+
<div class="method-description">
|
376
|
+
|
377
|
+
|
378
|
+
|
379
|
+
|
380
|
+
|
381
|
+
|
382
|
+
<div class="method-source-code" id="end_commands-source">
|
383
|
+
<pre><span class="ruby-comment"># File lib/hook/markdown_document_listener.rb, line 133</span>
|
384
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">end_commands</span>
|
385
|
+
<span class="ruby-identifier">decrement_nest</span>
|
386
|
+
<span class="ruby-keyword">end</span></pre>
|
387
|
+
</div>
|
388
|
+
|
389
|
+
</div>
|
390
|
+
|
391
|
+
|
392
|
+
|
393
|
+
|
394
|
+
</div>
|
395
|
+
|
396
|
+
|
397
|
+
<div id="method-i-end_options" class="method-detail ">
|
398
|
+
|
399
|
+
<div class="method-heading">
|
400
|
+
<span class="method-name">end_options</span><span
|
401
|
+
class="method-args">()</span>
|
402
|
+
|
403
|
+
<span class="method-click-advice">click to toggle source</span>
|
404
|
+
|
405
|
+
</div>
|
406
|
+
|
407
|
+
|
408
|
+
<div class="method-description">
|
409
|
+
|
410
|
+
|
411
|
+
|
412
|
+
|
413
|
+
|
414
|
+
|
415
|
+
<div class="method-source-code" id="end_options-source">
|
416
|
+
<pre><span class="ruby-comment"># File lib/hook/markdown_document_listener.rb, line 101</span>
|
417
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">end_options</span>
|
418
|
+
<span class="ruby-keyword">end</span></pre>
|
419
|
+
</div>
|
420
|
+
|
421
|
+
</div>
|
422
|
+
|
423
|
+
|
424
|
+
|
425
|
+
|
426
|
+
</div>
|
427
|
+
|
428
|
+
|
429
|
+
<div id="method-i-ending" class="method-detail ">
|
430
|
+
|
431
|
+
<div class="method-heading">
|
432
|
+
<span class="method-name">ending</span><span
|
433
|
+
class="method-args">()</span>
|
434
|
+
|
435
|
+
<span class="method-click-advice">click to toggle source</span>
|
436
|
+
|
437
|
+
</div>
|
438
|
+
|
439
|
+
|
440
|
+
<div class="method-description">
|
441
|
+
|
442
|
+
<p>Called when processing has completed</p>
|
443
|
+
|
444
|
+
|
445
|
+
|
446
|
+
|
447
|
+
<div class="method-source-code" id="ending-source">
|
448
|
+
<pre><span class="ruby-comment"># File lib/hook/markdown_document_listener.rb, line 24</span>
|
449
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">ending</span>
|
450
|
+
<span class="ruby-keyword">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-string">'CREDITS.md'</span>)
|
451
|
+
<span class="ruby-ivar">@io</span>.<span class="ruby-identifier">puts</span> <span class="ruby-constant">IO</span>.<span class="ruby-identifier">read</span>(<span class="ruby-string">'CREDITS.md'</span>)
|
452
|
+
<span class="ruby-ivar">@io</span>.<span class="ruby-identifier">puts</span>
|
453
|
+
<span class="ruby-keyword">end</span>
|
454
|
+
<span class="ruby-keyword">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-string">'LICENSE.md'</span>)
|
455
|
+
<span class="ruby-ivar">@io</span>.<span class="ruby-identifier">puts</span> <span class="ruby-constant">IO</span>.<span class="ruby-identifier">read</span>(<span class="ruby-string">'LICENSE.md'</span>)
|
456
|
+
<span class="ruby-ivar">@io</span>.<span class="ruby-identifier">puts</span>
|
457
|
+
<span class="ruby-keyword">end</span>
|
458
|
+
<span class="ruby-ivar">@io</span>.<span class="ruby-identifier">puts</span>
|
459
|
+
<span class="ruby-ivar">@io</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">"Documentation generated #{Time.now.strftime('%Y-%m-%d %H:%M')}"</span>
|
460
|
+
<span class="ruby-ivar">@io</span>.<span class="ruby-identifier">puts</span>
|
461
|
+
<span class="ruby-ivar">@io</span>.<span class="ruby-identifier">close</span>
|
462
|
+
<span class="ruby-keyword">end</span></pre>
|
463
|
+
</div>
|
464
|
+
|
465
|
+
</div>
|
466
|
+
|
467
|
+
|
468
|
+
|
469
|
+
|
470
|
+
</div>
|
471
|
+
|
472
|
+
|
473
|
+
<div id="method-i-flag" class="method-detail ">
|
474
|
+
|
475
|
+
<div class="method-heading">
|
476
|
+
<span class="method-name">flag</span><span
|
477
|
+
class="method-args">(name, aliases, desc, long_desc, default_value, arg_name, must_match, _type)</span>
|
478
|
+
|
479
|
+
<span class="method-click-advice">click to toggle source</span>
|
480
|
+
|
481
|
+
</div>
|
482
|
+
|
483
|
+
|
484
|
+
<div class="method-description">
|
485
|
+
|
486
|
+
<p>Gives you a flag in the current context</p>
|
487
|
+
|
488
|
+
|
489
|
+
|
490
|
+
|
491
|
+
<div class="method-source-code" id="flag-source">
|
492
|
+
<pre><span class="ruby-comment"># File lib/hook/markdown_document_listener.rb, line 73</span>
|
493
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">flag</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">aliases</span>, <span class="ruby-identifier">desc</span>, <span class="ruby-identifier">long_desc</span>, <span class="ruby-identifier">default_value</span>, <span class="ruby-identifier">arg_name</span>, <span class="ruby-identifier">must_match</span>, <span class="ruby-identifier">_type</span>)
|
494
|
+
<span class="ruby-identifier">invocations</span> = ([<span class="ruby-identifier">name</span>] <span class="ruby-operator">+</span> <span class="ruby-constant">Array</span>(<span class="ruby-identifier">aliases</span>)).<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">_</span><span class="ruby-operator">|</span> <span class="ruby-string">"`"</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">add_dashes</span>(<span class="ruby-identifier">_</span>) <span class="ruby-operator">+</span> <span class="ruby-string">"`"</span> }.<span class="ruby-identifier">join</span>(<span class="ruby-string">' | '</span>)
|
495
|
+
<span class="ruby-identifier">usage</span> = <span class="ruby-node">"#{invocations} #{arg_name || 'arg'}"</span>
|
496
|
+
<span class="ruby-ivar">@io</span>.<span class="ruby-identifier">puts</span> <span class="ruby-identifier">header</span>(<span class="ruby-identifier">usage</span>, <span class="ruby-value">2</span>)
|
497
|
+
<span class="ruby-ivar">@io</span>.<span class="ruby-identifier">puts</span>
|
498
|
+
<span class="ruby-ivar">@io</span>.<span class="ruby-identifier">puts</span> <span class="ruby-constant">String</span>(<span class="ruby-identifier">desc</span>).<span class="ruby-identifier">strip</span>
|
499
|
+
<span class="ruby-ivar">@io</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">"\n*Default Value:* `#{default_value || 'None'}`\n"</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">default_value</span>.<span class="ruby-identifier">nil?</span>
|
500
|
+
<span class="ruby-ivar">@io</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">"\n*Must Match:* `#{must_match.to_s}`\n"</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">must_match</span>.<span class="ruby-identifier">nil?</span>
|
501
|
+
<span class="ruby-identifier">cmd_desc</span> = <span class="ruby-constant">String</span>(<span class="ruby-identifier">long_desc</span>).<span class="ruby-identifier">strip</span>
|
502
|
+
<span class="ruby-ivar">@io</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">"> #{cmd_desc}\n"</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">cmd_desc</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
|
503
|
+
<span class="ruby-ivar">@io</span>.<span class="ruby-identifier">puts</span>
|
504
|
+
<span class="ruby-keyword">end</span></pre>
|
505
|
+
</div>
|
506
|
+
|
507
|
+
</div>
|
508
|
+
|
509
|
+
|
510
|
+
|
511
|
+
|
512
|
+
</div>
|
513
|
+
|
514
|
+
|
515
|
+
<div id="method-i-options" class="method-detail ">
|
516
|
+
|
517
|
+
<div class="method-heading">
|
518
|
+
<span class="method-name">options</span><span
|
519
|
+
class="method-args">()</span>
|
520
|
+
|
521
|
+
<span class="method-click-advice">click to toggle source</span>
|
522
|
+
|
523
|
+
</div>
|
524
|
+
|
525
|
+
|
526
|
+
<div class="method-description">
|
527
|
+
|
528
|
+
|
529
|
+
|
530
|
+
|
531
|
+
|
532
|
+
|
533
|
+
<div class="method-source-code" id="options-source">
|
534
|
+
<pre><span class="ruby-comment"># File lib/hook/markdown_document_listener.rb, line 63</span>
|
535
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">options</span>
|
536
|
+
<span class="ruby-keyword">if</span> <span class="ruby-ivar">@nest</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span>
|
537
|
+
<span class="ruby-ivar">@io</span>.<span class="ruby-identifier">puts</span> <span class="ruby-string">"## Global Options"</span>
|
538
|
+
<span class="ruby-keyword">else</span>
|
539
|
+
<span class="ruby-ivar">@io</span>.<span class="ruby-identifier">puts</span> <span class="ruby-identifier">header</span>(<span class="ruby-string">"Options"</span>, <span class="ruby-value">1</span>)
|
540
|
+
<span class="ruby-keyword">end</span>
|
541
|
+
<span class="ruby-ivar">@io</span>.<span class="ruby-identifier">puts</span>
|
542
|
+
<span class="ruby-keyword">end</span></pre>
|
543
|
+
</div>
|
544
|
+
|
545
|
+
</div>
|
546
|
+
|
547
|
+
|
548
|
+
|
549
|
+
|
550
|
+
</div>
|
551
|
+
|
552
|
+
|
553
|
+
<div id="method-i-program_desc" class="method-detail ">
|
554
|
+
|
555
|
+
<div class="method-heading">
|
556
|
+
<span class="method-name">program_desc</span><span
|
557
|
+
class="method-args">(desc)</span>
|
558
|
+
|
559
|
+
<span class="method-click-advice">click to toggle source</span>
|
560
|
+
|
561
|
+
</div>
|
562
|
+
|
563
|
+
|
564
|
+
<div class="method-description">
|
565
|
+
|
566
|
+
<p>Gives you the program description</p>
|
567
|
+
|
568
|
+
|
569
|
+
|
570
|
+
|
571
|
+
<div class="method-source-code" id="program_desc-source">
|
572
|
+
<pre><span class="ruby-comment"># File lib/hook/markdown_document_listener.rb, line 40</span>
|
573
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">program_desc</span>(<span class="ruby-identifier">desc</span>)
|
574
|
+
<span class="ruby-ivar">@io</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">"# #{@exe} CLI"</span>
|
575
|
+
<span class="ruby-ivar">@io</span>.<span class="ruby-identifier">puts</span>
|
576
|
+
<span class="ruby-ivar">@io</span>.<span class="ruby-identifier">puts</span> <span class="ruby-identifier">desc</span>
|
577
|
+
<span class="ruby-ivar">@io</span>.<span class="ruby-identifier">puts</span>
|
578
|
+
<span class="ruby-keyword">end</span></pre>
|
579
|
+
</div>
|
580
|
+
|
581
|
+
</div>
|
582
|
+
|
583
|
+
|
584
|
+
|
585
|
+
|
586
|
+
</div>
|
587
|
+
|
588
|
+
|
589
|
+
<div id="method-i-program_long_desc" class="method-detail ">
|
590
|
+
|
591
|
+
<div class="method-heading">
|
592
|
+
<span class="method-name">program_long_desc</span><span
|
593
|
+
class="method-args">(desc)</span>
|
594
|
+
|
595
|
+
<span class="method-click-advice">click to toggle source</span>
|
596
|
+
|
597
|
+
</div>
|
598
|
+
|
599
|
+
|
600
|
+
<div class="method-description">
|
601
|
+
|
602
|
+
|
603
|
+
|
604
|
+
|
605
|
+
|
606
|
+
|
607
|
+
<div class="method-source-code" id="program_long_desc-source">
|
608
|
+
<pre><span class="ruby-comment"># File lib/hook/markdown_document_listener.rb, line 47</span>
|
609
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">program_long_desc</span>(<span class="ruby-identifier">desc</span>)
|
610
|
+
<span class="ruby-ivar">@io</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">"> #{desc}"</span>
|
611
|
+
<span class="ruby-ivar">@io</span>.<span class="ruby-identifier">puts</span>
|
612
|
+
<span class="ruby-keyword">end</span></pre>
|
613
|
+
</div>
|
614
|
+
|
615
|
+
</div>
|
616
|
+
|
617
|
+
|
618
|
+
|
619
|
+
|
620
|
+
</div>
|
621
|
+
|
622
|
+
|
623
|
+
<div id="method-i-switch" class="method-detail ">
|
624
|
+
|
625
|
+
<div class="method-heading">
|
626
|
+
<span class="method-name">switch</span><span
|
627
|
+
class="method-args">(name, aliases, desc, long_desc, negatable)</span>
|
628
|
+
|
629
|
+
<span class="method-click-advice">click to toggle source</span>
|
630
|
+
|
631
|
+
</div>
|
632
|
+
|
633
|
+
|
634
|
+
<div class="method-description">
|
635
|
+
|
636
|
+
<p>Gives you a switch in the current context</p>
|
637
|
+
|
638
|
+
|
639
|
+
|
640
|
+
|
641
|
+
<div class="method-source-code" id="switch-source">
|
642
|
+
<pre><span class="ruby-comment"># File lib/hook/markdown_document_listener.rb, line 87</span>
|
643
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">switch</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">aliases</span>, <span class="ruby-identifier">desc</span>, <span class="ruby-identifier">long_desc</span>, <span class="ruby-identifier">negatable</span>)
|
644
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">negatable</span>
|
645
|
+
<span class="ruby-identifier">name</span> = <span class="ruby-node">"[no-]#{name}"</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">></span> <span class="ruby-value">1</span>
|
646
|
+
<span class="ruby-identifier">aliases</span> = <span class="ruby-identifier">aliases</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">_</span><span class="ruby-operator">|</span> <span class="ruby-identifier">_</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">></span> <span class="ruby-value">1</span> <span class="ruby-operator">?</span> <span class="ruby-node">"[no-]#{_}"</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">_</span> }
|
647
|
+
<span class="ruby-keyword">end</span>
|
648
|
+
<span class="ruby-identifier">invocations</span> = ([<span class="ruby-identifier">name</span>] <span class="ruby-operator">+</span> <span class="ruby-identifier">aliases</span>).<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">_</span><span class="ruby-operator">|</span> <span class="ruby-string">"`"</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">add_dashes</span>(<span class="ruby-identifier">_</span>) <span class="ruby-operator">+</span> <span class="ruby-string">"`"</span> }.<span class="ruby-identifier">join</span>(<span class="ruby-string">'|'</span>)
|
649
|
+
<span class="ruby-ivar">@io</span>.<span class="ruby-identifier">puts</span> <span class="ruby-identifier">header</span>(<span class="ruby-node">"#{invocations}"</span>, <span class="ruby-value">2</span>)
|
650
|
+
<span class="ruby-ivar">@io</span>.<span class="ruby-identifier">puts</span>
|
651
|
+
<span class="ruby-ivar">@io</span>.<span class="ruby-identifier">puts</span> <span class="ruby-constant">String</span>(<span class="ruby-identifier">desc</span>).<span class="ruby-identifier">strip</span>
|
652
|
+
<span class="ruby-identifier">cmd_desc</span> = <span class="ruby-constant">String</span>(<span class="ruby-identifier">long_desc</span>).<span class="ruby-identifier">strip</span>
|
653
|
+
<span class="ruby-ivar">@io</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">"\n> #{cmd_desc}\n"</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">cmd_desc</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
|
654
|
+
<span class="ruby-ivar">@io</span>.<span class="ruby-identifier">puts</span>
|
655
|
+
<span class="ruby-keyword">end</span></pre>
|
656
|
+
</div>
|
657
|
+
|
658
|
+
</div>
|
659
|
+
|
660
|
+
|
661
|
+
|
662
|
+
|
663
|
+
</div>
|
664
|
+
|
665
|
+
|
666
|
+
<div id="method-i-version" class="method-detail ">
|
667
|
+
|
668
|
+
<div class="method-heading">
|
669
|
+
<span class="method-name">version</span><span
|
670
|
+
class="method-args">(version)</span>
|
671
|
+
|
672
|
+
<span class="method-click-advice">click to toggle source</span>
|
673
|
+
|
674
|
+
</div>
|
675
|
+
|
676
|
+
|
677
|
+
<div class="method-description">
|
678
|
+
|
679
|
+
<p>Gives you the program version</p>
|
680
|
+
|
681
|
+
|
682
|
+
|
683
|
+
|
684
|
+
<div class="method-source-code" id="version-source">
|
685
|
+
<pre><span class="ruby-comment"># File lib/hook/markdown_document_listener.rb, line 53</span>
|
686
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">version</span>(<span class="ruby-identifier">version</span>)
|
687
|
+
<span class="ruby-ivar">@io</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">"*v#{version}*"</span>
|
688
|
+
<span class="ruby-ivar">@io</span>.<span class="ruby-identifier">puts</span>
|
689
|
+
<span class="ruby-comment"># Hacking in the overview file</span>
|
690
|
+
<span class="ruby-keyword">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-string">'OVERVIEW.md'</span>)
|
691
|
+
<span class="ruby-ivar">@io</span>.<span class="ruby-identifier">puts</span> <span class="ruby-constant">IO</span>.<span class="ruby-identifier">read</span>(<span class="ruby-string">'OVERVIEW.md'</span>)
|
692
|
+
<span class="ruby-ivar">@io</span>.<span class="ruby-identifier">puts</span>
|
693
|
+
<span class="ruby-keyword">end</span>
|
694
|
+
<span class="ruby-keyword">end</span></pre>
|
695
|
+
</div>
|
696
|
+
|
697
|
+
</div>
|
698
|
+
|
699
|
+
|
700
|
+
|
701
|
+
|
702
|
+
</div>
|
703
|
+
|
704
|
+
|
705
|
+
</section>
|
706
|
+
|
707
|
+
</section>
|
708
|
+
|
709
|
+
</main>
|
710
|
+
|
711
|
+
|
712
|
+
<footer id="validator-badges" role="contentinfo">
|
713
|
+
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
714
|
+
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.2.1.
|
715
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
716
|
+
</footer>
|
717
|
+
|