mu 5.7.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (117) hide show
  1. data/Mu_Gem.html +1591 -0
  2. data/bin/mu +11 -0
  3. data/lib/mu.rb +65 -0
  4. data/lib/mu/api/ddt.rb +233 -0
  5. data/lib/mu/api/homepage.rb +54 -0
  6. data/lib/mu/api/muapi.rb +231 -0
  7. data/lib/mu/api/netconfig.rb +233 -0
  8. data/lib/mu/api/scale.rb +199 -0
  9. data/lib/mu/api/system.rb +40 -0
  10. data/lib/mu/client.rb +31 -0
  11. data/lib/mu/command.rb +28 -0
  12. data/lib/mu/command/api.rb +95 -0
  13. data/lib/mu/command/cmd_appid.rb +486 -0
  14. data/lib/mu/command/cmd_cli.rb +151 -0
  15. data/lib/mu/command/cmd_ddt.rb +449 -0
  16. data/lib/mu/command/cmd_homepage.rb +146 -0
  17. data/lib/mu/command/cmd_muapi.rb +361 -0
  18. data/lib/mu/command/cmd_netconfig.rb +262 -0
  19. data/lib/mu/command/cmd_runscale.rb +533 -0
  20. data/lib/mu/command/cmd_runscenario.rb +258 -0
  21. data/lib/mu/command/cmd_runverify.rb +336 -0
  22. data/lib/mu/command/cmd_scale.rb +333 -0
  23. data/lib/mu/command/cmd_system.rb +127 -0
  24. data/lib/mu/command/curl.rb +246 -0
  25. data/lib/mu/command/help.rb +29 -0
  26. data/lib/mu/curl/error.rb +54 -0
  27. data/lib/mu/curl/verify.rb +137 -0
  28. data/lib/mu/helper.rb +55 -0
  29. data/lib/mu/http_helper.rb +232 -0
  30. data/rdoc/classes/Mu.html +305 -0
  31. data/rdoc/classes/Mu/Client.html +265 -0
  32. data/rdoc/classes/Mu/Command.html +208 -0
  33. data/rdoc/classes/Mu/Command/API.html +524 -0
  34. data/rdoc/classes/Mu/Command/Cmd_appid.html +934 -0
  35. data/rdoc/classes/Mu/Command/Cmd_cli.html +515 -0
  36. data/rdoc/classes/Mu/Command/Cmd_ddt.html +1169 -0
  37. data/rdoc/classes/Mu/Command/Cmd_homepage.html +489 -0
  38. data/rdoc/classes/Mu/Command/Cmd_muapi.html +968 -0
  39. data/rdoc/classes/Mu/Command/Cmd_netconfig.html +743 -0
  40. data/rdoc/classes/Mu/Command/Cmd_runscale.html +970 -0
  41. data/rdoc/classes/Mu/Command/Cmd_runscenario.html +530 -0
  42. data/rdoc/classes/Mu/Command/Cmd_runverify.html +621 -0
  43. data/rdoc/classes/Mu/Command/Cmd_scale.html +939 -0
  44. data/rdoc/classes/Mu/Command/Cmd_system.html +426 -0
  45. data/rdoc/classes/Mu/Command/Curl.html +524 -0
  46. data/rdoc/classes/Mu/Command/Help.html +166 -0
  47. data/rdoc/classes/Mu/Curl.html +116 -0
  48. data/rdoc/classes/Mu/Curl/Error.html +157 -0
  49. data/rdoc/classes/Mu/Curl/Error/Authorize.html +178 -0
  50. data/rdoc/classes/Mu/Curl/Error/Connect.html +149 -0
  51. data/rdoc/classes/Mu/Curl/Error/DNS.html +113 -0
  52. data/rdoc/classes/Mu/Curl/Error/Region.html +160 -0
  53. data/rdoc/classes/Mu/Curl/Error/Status.html +149 -0
  54. data/rdoc/classes/Mu/Curl/Error/Timeout.html +149 -0
  55. data/rdoc/classes/Mu/Curl/Verify.html +282 -0
  56. data/rdoc/classes/Mu/Curl/Verify/Request.html +227 -0
  57. data/rdoc/classes/Mu/Curl/Verify/Response.html +187 -0
  58. data/rdoc/classes/Mu/Curl/Verify/Result.html +188 -0
  59. data/rdoc/classes/Mu/Ddt.html +914 -0
  60. data/rdoc/classes/Mu/Helper.html +308 -0
  61. data/rdoc/classes/Mu/Homepage.html +377 -0
  62. data/rdoc/classes/Mu/HttpHelper.html +639 -0
  63. data/rdoc/classes/Mu/Muapi.html +816 -0
  64. data/rdoc/classes/Mu/Netconfig.html +781 -0
  65. data/rdoc/classes/Mu/Scale.html +832 -0
  66. data/rdoc/classes/Mu/System.html +281 -0
  67. data/rdoc/classes/Object.html +148 -0
  68. data/rdoc/classes/TCTestMu.html +1793 -0
  69. data/rdoc/classes/Test.html +107 -0
  70. data/rdoc/classes/Test/Unit.html +107 -0
  71. data/rdoc/classes/Test/Unit/TestCase.html +113 -0
  72. data/rdoc/created.rid +1 -0
  73. data/rdoc/files/lib/mu/api/ddt_rb.html +101 -0
  74. data/rdoc/files/lib/mu/api/homepage_rb.html +101 -0
  75. data/rdoc/files/lib/mu/api/muapi_rb.html +101 -0
  76. data/rdoc/files/lib/mu/api/netconfig_rb.html +101 -0
  77. data/rdoc/files/lib/mu/api/scale_rb.html +101 -0
  78. data/rdoc/files/lib/mu/api/system_rb.html +101 -0
  79. data/rdoc/files/lib/mu/client_rb.html +101 -0
  80. data/rdoc/files/lib/mu/command/api_rb.html +101 -0
  81. data/rdoc/files/lib/mu/command/cmd_appid_rb.html +119 -0
  82. data/rdoc/files/lib/mu/command/cmd_cli_rb.html +108 -0
  83. data/rdoc/files/lib/mu/command/cmd_ddt_rb.html +117 -0
  84. data/rdoc/files/lib/mu/command/cmd_homepage_rb.html +115 -0
  85. data/rdoc/files/lib/mu/command/cmd_muapi_rb.html +116 -0
  86. data/rdoc/files/lib/mu/command/cmd_netconfig_rb.html +116 -0
  87. data/rdoc/files/lib/mu/command/cmd_runscale_rb.html +119 -0
  88. data/rdoc/files/lib/mu/command/cmd_runscenario_rb.html +115 -0
  89. data/rdoc/files/lib/mu/command/cmd_runverify_rb.html +117 -0
  90. data/rdoc/files/lib/mu/command/cmd_scale_rb.html +115 -0
  91. data/rdoc/files/lib/mu/command/cmd_system_rb.html +116 -0
  92. data/rdoc/files/lib/mu/command/curl_rb.html +101 -0
  93. data/rdoc/files/lib/mu/command/help_rb.html +101 -0
  94. data/rdoc/files/lib/mu/command_rb.html +107 -0
  95. data/rdoc/files/lib/mu/curl/error_rb.html +101 -0
  96. data/rdoc/files/lib/mu/curl/verify_rb.html +101 -0
  97. data/rdoc/files/lib/mu/helper_rb.html +101 -0
  98. data/rdoc/files/lib/mu/http_helper_rb.html +101 -0
  99. data/rdoc/files/lib/mu_rb.html +121 -0
  100. data/rdoc/files/test/helper_rb.html +112 -0
  101. data/rdoc/files/test/tc_test_mu_rb.html +111 -0
  102. data/rdoc/fr_class_index.html +68 -0
  103. data/rdoc/fr_file_index.html +55 -0
  104. data/rdoc/fr_method_index.html +374 -0
  105. data/rdoc/index.html +24 -0
  106. data/rdoc/rdoc-style.css +208 -0
  107. data/test/data/app_id_stats.csv +1 -0
  108. data/test/data/data_cgi.msl +94 -0
  109. data/test/data/data_cgi.xml +322 -0
  110. data/test/data/default_test.csv +3 -0
  111. data/test/data/ftp_with_channel.xml +1643 -0
  112. data/test/data/irc.xml +3837 -0
  113. data/test/data/scale_configuration.json +25 -0
  114. data/test/data/test_data_cgi_error.xml +35 -0
  115. data/test/helper.rb +18 -0
  116. data/test/tc_test_mu.rb +716 -0
  117. metadata +322 -0
@@ -0,0 +1,515 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Class: Mu::Command::Cmd_cli</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Class</strong></td>
53
+ <td class="class-name-in-header">Mu::Command::Cmd_cli</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../../files/lib/mu/command/cmd_cli_rb.html">
59
+ lib/mu/command/cmd_cli.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ <tr class="top-aligned-row">
66
+ <td><strong>Parent:</strong></td>
67
+ <td>
68
+ Command
69
+ </td>
70
+ </tr>
71
+ </table>
72
+ </div>
73
+ <!-- banner header -->
74
+
75
+ <div id="bodyContent">
76
+
77
+
78
+
79
+ <div id="contextContent">
80
+
81
+
82
+
83
+ </div>
84
+
85
+ <div id="method-list">
86
+ <h3 class="section-bar">Methods</h3>
87
+
88
+ <div class="name-list">
89
+ <a href="#M000256">cmd_cli_help</a>&nbsp;&nbsp;
90
+ <a href="#M000255">cmd_help</a>&nbsp;&nbsp;
91
+ <a href="#M000258">cmd_history</a>&nbsp;&nbsp;
92
+ <a href="#M000259">cmd_ping</a>&nbsp;&nbsp;
93
+ <a href="#M000257">cmd_question</a>&nbsp;&nbsp;
94
+ <a href="#M000260">cmd_traceroute</a>&nbsp;&nbsp;
95
+ <a href="#M000264">help</a>&nbsp;&nbsp;
96
+ <a href="#M000263">parse_cli</a>&nbsp;&nbsp;
97
+ <a href="#M000261">run_cmd</a>&nbsp;&nbsp;
98
+ <a href="#M000262">setup</a>&nbsp;&nbsp;
99
+ </div>
100
+ </div>
101
+
102
+ </div>
103
+
104
+
105
+ <!-- if includes -->
106
+
107
+ <div id="section">
108
+
109
+
110
+
111
+
112
+
113
+ <div id="attribute-list">
114
+ <h3 class="section-bar">Attributes</h3>
115
+
116
+ <div class="name-list">
117
+ <table>
118
+ <tr class="top-aligned-row context-row">
119
+ <td class="context-item-name">api</td>
120
+ <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
121
+ <td class="context-item-desc"></td>
122
+ </tr>
123
+ <tr class="top-aligned-row context-row">
124
+ <td class="context-item-name">host</td>
125
+ <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
126
+ <td class="context-item-desc"></td>
127
+ </tr>
128
+ <tr class="top-aligned-row context-row">
129
+ <td class="context-item-name">password</td>
130
+ <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
131
+ <td class="context-item-desc"></td>
132
+ </tr>
133
+ <tr class="top-aligned-row context-row">
134
+ <td class="context-item-name">username</td>
135
+ <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
136
+ <td class="context-item-desc"></td>
137
+ </tr>
138
+ </table>
139
+ </div>
140
+ </div>
141
+
142
+
143
+
144
+ <!-- if method_list -->
145
+ <div id="methods">
146
+ <h3 class="section-bar">Public Instance methods</h3>
147
+
148
+ <div id="method-M000256" class="method-detail">
149
+ <a name="M000256"></a>
150
+
151
+ <div class="method-heading">
152
+ <a href="#M000256" class="method-signature">
153
+ <span class="method-name">cmd_cli_help</span><span class="method-args">(argv)</span>
154
+ </a>
155
+ </div>
156
+
157
+ <div class="method-description">
158
+ <p>
159
+ runs the cli <a href="Cmd_cli.html#M000264">help</a> command
160
+ </p>
161
+ <pre>
162
+ * argv = command-line arguments
163
+ </pre>
164
+ <p><a class="source-toggle" href="#"
165
+ onclick="toggleCode('M000256-source');return false;">[Source]</a></p>
166
+ <div class="method-source-code" id="M000256-source">
167
+ <pre>
168
+ <span class="ruby-comment cmt"># File lib/mu/command/cmd_cli.rb, line 15</span>
169
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cmd_cli_help</span> <span class="ruby-identifier">argv</span>
170
+ <span class="ruby-identifier">setup</span> <span class="ruby-identifier">argv</span>
171
+ <span class="ruby-identifier">msg</span> <span class="ruby-identifier">run_cmd</span>(<span class="ruby-value str">&quot;help&quot;</span>)
172
+ <span class="ruby-keyword kw">end</span>
173
+ </pre>
174
+ </div>
175
+ </div>
176
+ </div>
177
+
178
+ <div id="method-M000255" class="method-detail">
179
+ <a name="M000255"></a>
180
+
181
+ <div class="method-heading">
182
+ <a href="#M000255" class="method-signature">
183
+ <span class="method-name">cmd_help</span><span class="method-args">(argv)</span>
184
+ </a>
185
+ </div>
186
+
187
+ <div class="method-description">
188
+ <p>
189
+ displays command-line <a href="Cmd_cli.html#M000264">help</a>
190
+ </p>
191
+ <p><a class="source-toggle" href="#"
192
+ onclick="toggleCode('M000255-source');return false;">[Source]</a></p>
193
+ <div class="method-source-code" id="M000255-source">
194
+ <pre>
195
+ <span class="ruby-comment cmt"># File lib/mu/command/cmd_cli.rb, line 9</span>
196
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cmd_help</span> <span class="ruby-identifier">argv</span>
197
+ <span class="ruby-identifier">help</span>
198
+ <span class="ruby-keyword kw">end</span>
199
+ </pre>
200
+ </div>
201
+ </div>
202
+ </div>
203
+
204
+ <div id="method-M000258" class="method-detail">
205
+ <a name="M000258"></a>
206
+
207
+ <div class="method-heading">
208
+ <a href="#M000258" class="method-signature">
209
+ <span class="method-name">cmd_history</span><span class="method-args">(argv)</span>
210
+ </a>
211
+ </div>
212
+
213
+ <div class="method-description">
214
+ <p>
215
+ displays the command line history for the current session
216
+ </p>
217
+ <pre>
218
+ * argv = command-line arguments
219
+ </pre>
220
+ <p><a class="source-toggle" href="#"
221
+ onclick="toggleCode('M000258-source');return false;">[Source]</a></p>
222
+ <div class="method-source-code" id="M000258-source">
223
+ <pre>
224
+ <span class="ruby-comment cmt"># File lib/mu/command/cmd_cli.rb, line 29</span>
225
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cmd_history</span> <span class="ruby-identifier">argv</span>
226
+ <span class="ruby-identifier">setup</span> <span class="ruby-identifier">argv</span>
227
+ <span class="ruby-identifier">msg</span> <span class="ruby-identifier">run_cmd</span>(<span class="ruby-value str">&quot;history&quot;</span>)
228
+ <span class="ruby-keyword kw">end</span>
229
+ </pre>
230
+ </div>
231
+ </div>
232
+ </div>
233
+
234
+ <div id="method-M000259" class="method-detail">
235
+ <a name="M000259"></a>
236
+
237
+ <div class="method-heading">
238
+ <a href="#M000259" class="method-signature">
239
+ <span class="method-name">cmd_ping</span><span class="method-args">(argv)</span>
240
+ </a>
241
+ </div>
242
+
243
+ <div class="method-description">
244
+ <p>
245
+ pings an ip address
246
+ </p>
247
+ <pre>
248
+ * argv = command-line arguments, requires an ip address (-a) argument
249
+ </pre>
250
+ <p><a class="source-toggle" href="#"
251
+ onclick="toggleCode('M000259-source');return false;">[Source]</a></p>
252
+ <div class="method-source-code" id="M000259-source">
253
+ <pre>
254
+ <span class="ruby-comment cmt"># File lib/mu/command/cmd_cli.rb, line 36</span>
255
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cmd_ping</span> <span class="ruby-identifier">argv</span>
256
+ <span class="ruby-identifier">setup</span> <span class="ruby-identifier">argv</span>
257
+ <span class="ruby-identifier">addr</span> = <span class="ruby-ivar">@hash</span>[<span class="ruby-value str">&quot;address&quot;</span>]
258
+ <span class="ruby-identifier">msg</span> <span class="ruby-identifier">run_cmd</span>(<span class="ruby-node">&quot;ping #{addr}&quot;</span>)
259
+ <span class="ruby-keyword kw">end</span>
260
+ </pre>
261
+ </div>
262
+ </div>
263
+ </div>
264
+
265
+ <div id="method-M000257" class="method-detail">
266
+ <a name="M000257"></a>
267
+
268
+ <div class="method-heading">
269
+ <a href="#M000257" class="method-signature">
270
+ <span class="method-name">cmd_question</span><span class="method-args">(argv)</span>
271
+ </a>
272
+ </div>
273
+
274
+ <div class="method-description">
275
+ <p>
276
+ runs the cli command &#8217;?&quot;
277
+ </p>
278
+ <pre>
279
+ * argv = command-line arguments
280
+ </pre>
281
+ <p><a class="source-toggle" href="#"
282
+ onclick="toggleCode('M000257-source');return false;">[Source]</a></p>
283
+ <div class="method-source-code" id="M000257-source">
284
+ <pre>
285
+ <span class="ruby-comment cmt"># File lib/mu/command/cmd_cli.rb, line 22</span>
286
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cmd_question</span> <span class="ruby-identifier">argv</span>
287
+ <span class="ruby-identifier">setup</span> <span class="ruby-identifier">argv</span>
288
+ <span class="ruby-identifier">msg</span> <span class="ruby-identifier">run_cmd</span>(<span class="ruby-value str">&quot;?&quot;</span>)
289
+ <span class="ruby-keyword kw">end</span>
290
+ </pre>
291
+ </div>
292
+ </div>
293
+ </div>
294
+
295
+ <div id="method-M000260" class="method-detail">
296
+ <a name="M000260"></a>
297
+
298
+ <div class="method-heading">
299
+ <a href="#M000260" class="method-signature">
300
+ <span class="method-name">cmd_traceroute</span><span class="method-args">(argv)</span>
301
+ </a>
302
+ </div>
303
+
304
+ <div class="method-description">
305
+ <p>
306
+ runs traceroute on an ip address
307
+ </p>
308
+ <pre>
309
+ * argv = command-line arguments, requires an ip address (-a) argument
310
+ </pre>
311
+ <p><a class="source-toggle" href="#"
312
+ onclick="toggleCode('M000260-source');return false;">[Source]</a></p>
313
+ <div class="method-source-code" id="M000260-source">
314
+ <pre>
315
+ <span class="ruby-comment cmt"># File lib/mu/command/cmd_cli.rb, line 44</span>
316
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cmd_traceroute</span> <span class="ruby-identifier">argv</span>
317
+ <span class="ruby-identifier">setup</span> <span class="ruby-identifier">argv</span>
318
+ <span class="ruby-identifier">addr</span> = <span class="ruby-ivar">@hash</span>[<span class="ruby-value str">&quot;address&quot;</span>]
319
+ <span class="ruby-identifier">msg</span> <span class="ruby-identifier">run_cmd</span>(<span class="ruby-node">&quot;traceroute #{addr}&quot;</span>)
320
+ <span class="ruby-keyword kw">end</span>
321
+ </pre>
322
+ </div>
323
+ </div>
324
+ </div>
325
+
326
+ <h3 class="section-bar">Private Instance methods</h3>
327
+
328
+ <div id="method-M000264" class="method-detail">
329
+ <a name="M000264"></a>
330
+
331
+ <div class="method-heading">
332
+ <a href="#M000264" class="method-signature">
333
+ <span class="method-name">help</span><span class="method-args">()</span>
334
+ </a>
335
+ </div>
336
+
337
+ <div class="method-description">
338
+ <p><a class="source-toggle" href="#"
339
+ onclick="toggleCode('M000264-source');return false;">[Source]</a></p>
340
+ <div class="method-source-code" id="M000264-source">
341
+ <pre>
342
+ <span class="ruby-comment cmt"># File lib/mu/command/cmd_cli.rb, line 115</span>
343
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">help</span>
344
+ <span class="ruby-identifier">helps</span> = [
345
+ { <span class="ruby-identifier">:short</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'-a'</span>, <span class="ruby-identifier">:long</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'--address'</span>, <span class="ruby-identifier">:value</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'&lt;string'</span>, <span class="ruby-identifier">:help</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'ip address to for ping or traceroute'</span> },
346
+ { <span class="ruby-identifier">:short</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'-h'</span>, <span class="ruby-identifier">:long</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'--help'</span>, <span class="ruby-identifier">:value</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">''</span>, <span class="ruby-identifier">:help</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'Help on command line options'</span> },
347
+ { <span class="ruby-identifier">:short</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'-o'</span>, <span class="ruby-identifier">:long</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'--output'</span>, <span class="ruby-identifier">:value</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'&lt;string&gt;'</span>, <span class="ruby-identifier">:help</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'output logging to this file'</span> },
348
+ { <span class="ruby-identifier">:short</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'-m'</span>, <span class="ruby-identifier">:long</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'--mu_string'</span>, <span class="ruby-identifier">:value</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'&lt;string&gt;'</span>, <span class="ruby-identifier">:help</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'user, password, mu_ip in the form of admin:admin@10.9.8.7'</span> },
349
+ { <span class="ruby-identifier">:short</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'-v'</span>, <span class="ruby-identifier">:long</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'--verbose'</span>, <span class="ruby-identifier">:value</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">''</span>, <span class="ruby-identifier">:help</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'set Logger::DEBUG level'</span> }
350
+ ]
351
+
352
+ <span class="ruby-identifier">cmds</span> = [
353
+ <span class="ruby-value str">&quot;mu cmd_cli:cli_help&quot;</span>,
354
+ <span class="ruby-value str">&quot;mu cmd_cli:history&quot;</span>,
355
+ <span class="ruby-value str">&quot;mu cmd_cli:ping -a &lt;address&gt;&quot;</span>,
356
+ <span class="ruby-value str">&quot;mu cmd_cli:question&quot;</span>,
357
+ <span class="ruby-value str">&quot;mu cmd_cli:traceroute -a &lt;address&gt;&quot;</span>,
358
+ ]
359
+
360
+ <span class="ruby-identifier">max_long_size</span> = <span class="ruby-identifier">helps</span>.<span class="ruby-identifier">inject</span>(<span class="ruby-value">0</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">memo</span>, <span class="ruby-identifier">obj</span><span class="ruby-operator">|</span> [ <span class="ruby-identifier">obj</span>[<span class="ruby-identifier">:long</span>].<span class="ruby-identifier">size</span>, <span class="ruby-identifier">memo</span> ].<span class="ruby-identifier">max</span> }
361
+ <span class="ruby-identifier">max_value_size</span> = <span class="ruby-identifier">helps</span>.<span class="ruby-identifier">inject</span>(<span class="ruby-value">0</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">memo</span>, <span class="ruby-identifier">obj</span><span class="ruby-operator">|</span> [ <span class="ruby-identifier">obj</span>[<span class="ruby-identifier">:value</span>].<span class="ruby-identifier">size</span>, <span class="ruby-identifier">memo</span> ].<span class="ruby-identifier">max</span> }
362
+ <span class="ruby-identifier">puts</span>
363
+ <span class="ruby-identifier">puts</span> <span class="ruby-value str">&quot;Usage: mu cmd_cli:&lt;command&gt; &lt;options&gt;&quot;</span>
364
+ <span class="ruby-identifier">puts</span>
365
+ <span class="ruby-identifier">helps</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">h</span><span class="ruby-operator">|</span>
366
+ <span class="ruby-identifier">puts</span> <span class="ruby-value str">&quot;%-*s %*s %-*s %s&quot;</span> <span class="ruby-operator">%</span> [<span class="ruby-identifier">max_long_size</span>, <span class="ruby-identifier">h</span>[<span class="ruby-identifier">:long</span>], <span class="ruby-value">2</span>, <span class="ruby-identifier">h</span>[<span class="ruby-identifier">:short</span>], <span class="ruby-identifier">max_value_size</span>, <span class="ruby-identifier">h</span>[<span class="ruby-identifier">:value</span>], <span class="ruby-identifier">h</span>[<span class="ruby-identifier">:help</span>]]
367
+ <span class="ruby-keyword kw">end</span>
368
+ <span class="ruby-identifier">puts</span>
369
+ <span class="ruby-identifier">puts</span> <span class="ruby-value str">&quot;Available Commands&quot;</span>
370
+ <span class="ruby-identifier">puts</span>
371
+ <span class="ruby-identifier">cmds</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">c</span> <span class="ruby-operator">|</span>
372
+ <span class="ruby-identifier">puts</span> <span class="ruby-identifier">c</span>
373
+ <span class="ruby-keyword kw">end</span>
374
+ <span class="ruby-identifier">puts</span>
375
+ <span class="ruby-keyword kw">end</span>
376
+ </pre>
377
+ </div>
378
+ </div>
379
+ </div>
380
+
381
+ <div id="method-M000263" class="method-detail">
382
+ <a name="M000263"></a>
383
+
384
+ <div class="method-heading">
385
+ <a href="#M000263" class="method-signature">
386
+ <span class="method-name">parse_cli</span><span class="method-args">(argv)</span>
387
+ </a>
388
+ </div>
389
+
390
+ <div class="method-description">
391
+ <p><a class="source-toggle" href="#"
392
+ onclick="toggleCode('M000263-source');return false;">[Source]</a></p>
393
+ <div class="method-source-code" id="M000263-source">
394
+ <pre>
395
+ <span class="ruby-comment cmt"># File lib/mu/command/cmd_cli.rb, line 72</span>
396
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parse_cli</span> <span class="ruby-identifier">argv</span>
397
+ <span class="ruby-ivar">@hash</span> = {}
398
+ <span class="ruby-identifier">args</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
399
+ <span class="ruby-keyword kw">while</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">argv</span>.<span class="ruby-identifier">empty?</span>
400
+ <span class="ruby-identifier">args</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">argv</span>.<span class="ruby-identifier">shift</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">argv</span>.<span class="ruby-identifier">first</span>[<span class="ruby-value">0</span>,<span class="ruby-value">1</span>] <span class="ruby-operator">!=</span> <span class="ruby-value str">'-'</span>
401
+
402
+ <span class="ruby-identifier">k</span> = <span class="ruby-identifier">argv</span>.<span class="ruby-identifier">shift</span>
403
+
404
+ <span class="ruby-keyword kw">if</span> [ <span class="ruby-value str">'-a'</span>, <span class="ruby-value str">'--address'</span> ].<span class="ruby-identifier">member?</span> <span class="ruby-identifier">k</span>
405
+ <span class="ruby-ivar">@hash</span>[<span class="ruby-value str">'address'</span>] = <span class="ruby-identifier">shift</span>(<span class="ruby-identifier">k</span>, <span class="ruby-identifier">argv</span>)
406
+ <span class="ruby-keyword kw">next</span>
407
+ <span class="ruby-keyword kw">end</span>
408
+
409
+ <span class="ruby-keyword kw">if</span> [ <span class="ruby-value str">'-h'</span>, <span class="ruby-value str">'--help'</span> ].<span class="ruby-identifier">member?</span> <span class="ruby-identifier">k</span>
410
+ <span class="ruby-identifier">help</span>
411
+ <span class="ruby-identifier">exit</span>
412
+ <span class="ruby-keyword kw">end</span>
413
+
414
+ <span class="ruby-keyword kw">if</span> [ <span class="ruby-value str">'-m'</span>, <span class="ruby-value str">'--mu_string'</span> ].<span class="ruby-identifier">member?</span> <span class="ruby-identifier">k</span>
415
+ <span class="ruby-identifier">mu_string</span> = <span class="ruby-identifier">shift</span>(<span class="ruby-identifier">k</span>, <span class="ruby-identifier">argv</span>)
416
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">mu_string</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/(.+?):(.+?)@(.*)/</span>
417
+ <span class="ruby-ivar">@@mu_admin_user</span> = <span class="ruby-identifier">$1</span>
418
+ <span class="ruby-ivar">@@mu_admin_pass</span> = <span class="ruby-identifier">$2</span>
419
+ <span class="ruby-ivar">@@mu_ip</span> = <span class="ruby-identifier">$3</span>
420
+ <span class="ruby-keyword kw">end</span>
421
+ <span class="ruby-keyword kw">next</span>
422
+ <span class="ruby-keyword kw">end</span>
423
+
424
+ <span class="ruby-keyword kw">if</span> [ <span class="ruby-value str">'-o'</span>, <span class="ruby-value str">'--output'</span> ].<span class="ruby-identifier">member?</span> <span class="ruby-identifier">k</span>
425
+ <span class="ruby-identifier">$stdout</span>.<span class="ruby-identifier">reopen</span>(<span class="ruby-identifier">shift</span>(<span class="ruby-identifier">k</span>, <span class="ruby-identifier">argv</span>), <span class="ruby-value str">&quot;w&quot;</span>)
426
+ <span class="ruby-keyword kw">next</span>
427
+ <span class="ruby-keyword kw">end</span>
428
+
429
+ <span class="ruby-keyword kw">if</span> [ <span class="ruby-value str">'-v'</span>, <span class="ruby-value str">'--verbose'</span> ].<span class="ruby-identifier">member?</span> <span class="ruby-identifier">k</span>
430
+ <span class="ruby-identifier">$log</span>.<span class="ruby-identifier">level</span> = <span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-constant">DEBUG</span>
431
+ <span class="ruby-keyword kw">next</span>
432
+ <span class="ruby-keyword kw">end</span>
433
+
434
+ <span class="ruby-keyword kw">end</span>
435
+
436
+ <span class="ruby-identifier">args</span>
437
+ <span class="ruby-keyword kw">end</span>
438
+ </pre>
439
+ </div>
440
+ </div>
441
+ </div>
442
+
443
+ <div id="method-M000261" class="method-detail">
444
+ <a name="M000261"></a>
445
+
446
+ <div class="method-heading">
447
+ <a href="#M000261" class="method-signature">
448
+ <span class="method-name">run_cmd</span><span class="method-args">(command, prompt=@prompt)</span>
449
+ </a>
450
+ </div>
451
+
452
+ <div class="method-description">
453
+ <p>
454
+ runs the cli command
455
+ </p>
456
+ <p><a class="source-toggle" href="#"
457
+ onclick="toggleCode('M000261-source');return false;">[Source]</a></p>
458
+ <div class="method-source-code" id="M000261-source">
459
+ <pre>
460
+ <span class="ruby-comment cmt"># File lib/mu/command/cmd_cli.rb, line 53</span>
461
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">run_cmd</span>(<span class="ruby-identifier">command</span>, <span class="ruby-identifier">prompt</span>=<span class="ruby-ivar">@prompt</span>)
462
+ <span class="ruby-identifier">msg</span> <span class="ruby-node">&quot;run command #{command}&quot;</span>
463
+ <span class="ruby-ivar">@pipe</span>.<span class="ruby-identifier">write</span>(<span class="ruby-node">&quot;#{command}\r&quot;</span>)
464
+ <span class="ruby-identifier">response</span> = <span class="ruby-ivar">@pipe</span>.<span class="ruby-identifier">readline</span>(<span class="ruby-identifier">prompt</span>)
465
+ <span class="ruby-ivar">@pipe</span>.<span class="ruby-identifier">close</span>
466
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">response</span>
467
+ <span class="ruby-keyword kw">end</span>
468
+ </pre>
469
+ </div>
470
+ </div>
471
+ </div>
472
+
473
+ <div id="method-M000262" class="method-detail">
474
+ <a name="M000262"></a>
475
+
476
+ <div class="method-heading">
477
+ <a href="#M000262" class="method-signature">
478
+ <span class="method-name">setup</span><span class="method-args">(argv)</span>
479
+ </a>
480
+ </div>
481
+
482
+ <div class="method-description">
483
+ <p><a class="source-toggle" href="#"
484
+ onclick="toggleCode('M000262-source');return false;">[Source]</a></p>
485
+ <div class="method-source-code" id="M000262-source">
486
+ <pre>
487
+ <span class="ruby-comment cmt"># File lib/mu/command/cmd_cli.rb, line 61</span>
488
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">setup</span> <span class="ruby-identifier">argv</span>
489
+ <span class="ruby-identifier">parse_cli</span> <span class="ruby-identifier">argv</span>
490
+ <span class="ruby-ivar">@host</span> = (<span class="ruby-ivar">@@mu_ip</span>.<span class="ruby-identifier">nil?</span>) <span class="ruby-operator">?</span> <span class="ruby-value str">&quot;127.0.0.1&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-ivar">@@mu_ip</span>
491
+ <span class="ruby-ivar">@username</span> = (<span class="ruby-ivar">@@mu_admin_user</span>.<span class="ruby-identifier">nil?</span>) <span class="ruby-operator">?</span> <span class="ruby-value str">&quot;admin&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-ivar">@@mu_admin_user</span>
492
+ <span class="ruby-ivar">@password</span> = (<span class="ruby-ivar">@@mu_admin_pass</span>.<span class="ruby-identifier">nil?</span>) <span class="ruby-operator">?</span> <span class="ruby-value str">&quot;admin&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-ivar">@@mu_admin_pass</span>
493
+ <span class="ruby-ivar">@prompt</span> = <span class="ruby-value str">&quot;MU&gt;&quot;</span>
494
+ <span class="ruby-ivar">@pipe</span> = <span class="ruby-constant">IO</span>.<span class="ruby-identifier">popen</span>(<span class="ruby-node">&quot;./lib/mu/cli/muclish.tcl #{@host} #{@password} '#{@prompt}'&quot;</span>, <span class="ruby-value str">'w+'</span>)
495
+ <span class="ruby-ivar">@pipe</span>.<span class="ruby-identifier">sync</span> = <span class="ruby-keyword kw">true</span>
496
+ <span class="ruby-ivar">@banner</span> = <span class="ruby-ivar">@pipe</span>.<span class="ruby-identifier">readline</span>(<span class="ruby-ivar">@prompt</span>)
497
+ <span class="ruby-keyword kw">end</span>
498
+ </pre>
499
+ </div>
500
+ </div>
501
+ </div>
502
+
503
+
504
+ </div>
505
+
506
+
507
+ </div>
508
+
509
+
510
+ <div id="validator-badges">
511
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
512
+ </div>
513
+
514
+ </body>
515
+ </html>