ftp_paradise 1.4.5 → 1.5.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.

Potentially problematic release.


This version of ftp_paradise might be problematic. Click here for more details.

Files changed (102) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +152 -28
  3. data/bin/{iftp → ftp_paradise_shell} +1 -1
  4. data/doc/README.gen +97 -15
  5. data/doc/todo/{TODO_FOR_FTP_PARADISE_PROJECT.md → todo_for_the_ftp_paradise_project.md} +0 -0
  6. data/ftp_paradise.gemspec +30 -39
  7. data/lib/ftp_paradise/base/base.rb +375 -0
  8. data/lib/ftp_paradise/colours/colours.rb +27 -27
  9. data/lib/ftp_paradise/colours/use_colours.rb +6 -1
  10. data/lib/ftp_paradise/configuration/configuration.rb +7 -4
  11. data/lib/ftp_paradise/connection/README.md +0 -0
  12. data/lib/ftp_paradise/connection/connection.rb +2782 -15
  13. data/lib/ftp_paradise/constants/constants.rb +91 -5
  14. data/lib/ftp_paradise/entry/entry.rb +42 -5
  15. data/lib/ftp_paradise/{connection → gui/gtk3/ftp_client}/constants.rb +33 -21
  16. data/lib/ftp_paradise/gui/{shared_code/ftp_paradise/ftp_paradise_module.rb → gtk3/ftp_client/ftp_client.rb} +658 -170
  17. data/lib/ftp_paradise/gui/gtk3/ftp_client/misc.rb +27 -0
  18. data/lib/ftp_paradise/project/project.rb +11 -15
  19. data/lib/ftp_paradise/requires/require_class_connection.rb +7 -0
  20. data/lib/ftp_paradise/requires/require_net_ftp.rb +7 -0
  21. data/lib/ftp_paradise/requires/require_the_ftp_paradise_project.rb +4 -3
  22. data/lib/ftp_paradise/requires/require_the_ftp_paradise_project_with_the_GUI_bindings.rb +1 -1
  23. data/lib/ftp_paradise/requires/require_the_toplevel_methods.rb +1 -0
  24. data/lib/ftp_paradise/{interactive_ftp → shell}/menu.rb +554 -448
  25. data/lib/ftp_paradise/shell/shell.rb +2321 -0
  26. data/lib/ftp_paradise/toplevel_methods/connect.rb +3 -0
  27. data/lib/ftp_paradise/toplevel_methods/dataset.rb +111 -0
  28. data/lib/ftp_paradise/toplevel_methods/file_related_actions.rb +4 -3
  29. data/lib/ftp_paradise/toplevel_methods/ftp_object.rb +6 -5
  30. data/lib/ftp_paradise/toplevel_methods/login_name.rb +6 -4
  31. data/lib/ftp_paradise/toplevel_methods/misc.rb +19 -0
  32. data/lib/ftp_paradise/toplevel_methods/opn.rb +1 -1
  33. data/lib/ftp_paradise/toplevel_methods/password.rb +4 -2
  34. data/lib/ftp_paradise/toplevel_methods/port.rb +4 -1
  35. data/lib/ftp_paradise/toplevel_methods/remote_url.rb +11 -5
  36. data/lib/ftp_paradise/toplevel_methods/upload_and_download.rb +1 -0
  37. data/lib/ftp_paradise/version/version.rb +6 -1
  38. data/lib/ftp_paradise/www/web_interface.cgi +1 -1
  39. data/lib/ftp_paradise/yaml/automatically_connect_on_startup_of_the_interactive_ftp_shell.yml +0 -0
  40. data/lib/ftp_paradise/yaml/debug.yml +0 -0
  41. data/lib/ftp_paradise/yaml/open_in_default_editor.yml +0 -0
  42. data/lib/ftp_paradise/yaml/show_full_names.yml +0 -0
  43. data/lib/ftp_paradise/yaml/use_colours.yml +0 -0
  44. data/test/testing_minimal_pure_net_ftp_example_to_connect.rb +13 -3
  45. metadata +52 -126
  46. data/lib/ftp_paradise/base/cliner.rb +0 -23
  47. data/lib/ftp_paradise/base/colours.rb +0 -83
  48. data/lib/ftp_paradise/base/prototype.rb +0 -171
  49. data/lib/ftp_paradise/base/reset.rb +0 -29
  50. data/lib/ftp_paradise/connection/data.rb +0 -164
  51. data/lib/ftp_paradise/connection/debug.rb +0 -78
  52. data/lib/ftp_paradise/connection/directory_handling.rb +0 -271
  53. data/lib/ftp_paradise/connection/do_login.rb +0 -108
  54. data/lib/ftp_paradise/connection/download.rb +0 -86
  55. data/lib/ftp_paradise/connection/file_handling.rb +0 -174
  56. data/lib/ftp_paradise/connection/ftp_object.rb +0 -21
  57. data/lib/ftp_paradise/connection/initialize.rb +0 -88
  58. data/lib/ftp_paradise/connection/initialize_a_new_net_ftp_object_with_this_url.rb +0 -20
  59. data/lib/ftp_paradise/connection/is_connected.rb +0 -46
  60. data/lib/ftp_paradise/connection/misc.rb +0 -474
  61. data/lib/ftp_paradise/connection/notify.rb +0 -71
  62. data/lib/ftp_paradise/connection/password.rb +0 -47
  63. data/lib/ftp_paradise/connection/port.rb +0 -33
  64. data/lib/ftp_paradise/connection/remote_pwd.rb +0 -72
  65. data/lib/ftp_paradise/connection/remote_url.rb +0 -164
  66. data/lib/ftp_paradise/connection/remove.rb +0 -143
  67. data/lib/ftp_paradise/connection/reset.rb +0 -78
  68. data/lib/ftp_paradise/connection/run.rb +0 -18
  69. data/lib/ftp_paradise/connection/set_array_available_hosts.rb +0 -27
  70. data/lib/ftp_paradise/connection/set_input.rb +0 -18
  71. data/lib/ftp_paradise/connection/show.rb +0 -153
  72. data/lib/ftp_paradise/connection/sync_ftp_object_onto_the_main_namespace.rb +0 -24
  73. data/lib/ftp_paradise/connection/transfer_mode.rb +0 -163
  74. data/lib/ftp_paradise/connection/upload.rb +0 -253
  75. data/lib/ftp_paradise/connection/use_default_dataset.rb +0 -40
  76. data/lib/ftp_paradise/connection/username.rb +0 -42
  77. data/lib/ftp_paradise/constants/misc.rb +0 -57
  78. data/lib/ftp_paradise/constants/namespace.rb +0 -14
  79. data/lib/ftp_paradise/constants/newline.rb +0 -14
  80. data/lib/ftp_paradise/constants/roebe.rb +0 -31
  81. data/lib/ftp_paradise/constants/roebe_ftp_constants.rb +0 -233
  82. data/lib/ftp_paradise/gui/gtk2/ftp_paradise.rb +0 -34
  83. data/lib/ftp_paradise/gui/gtk3/ftp_paradise.rb +0 -34
  84. data/lib/ftp_paradise/interactive_ftp/constants.rb +0 -103
  85. data/lib/ftp_paradise/interactive_ftp/directory_handling.rb +0 -216
  86. data/lib/ftp_paradise/interactive_ftp/help.rb +0 -50
  87. data/lib/ftp_paradise/interactive_ftp/initialize.rb +0 -27
  88. data/lib/ftp_paradise/interactive_ftp/interactive_ftp.rb +0 -998
  89. data/lib/ftp_paradise/interactive_ftp/main_loop.rb +0 -51
  90. data/lib/ftp_paradise/interactive_ftp/misc.rb +0 -208
  91. data/lib/ftp_paradise/interactive_ftp/mode.rb +0 -124
  92. data/lib/ftp_paradise/interactive_ftp/readline.rb +0 -113
  93. data/lib/ftp_paradise/interactive_ftp/remove.rb +0 -97
  94. data/lib/ftp_paradise/interactive_ftp/reset.rb +0 -90
  95. data/lib/ftp_paradise/interactive_ftp/run.rb +0 -22
  96. data/lib/ftp_paradise/interactive_ftp/show.rb +0 -184
  97. data/lib/ftp_paradise/interactive_ftp/upload.rb +0 -90
  98. data/lib/ftp_paradise/interactive_ftp/user_input.rb +0 -53
  99. data/lib/ftp_paradise/toplevel_methods/can_connect_to_remote_site.rb +0 -28
  100. data/lib/ftp_paradise/toplevel_methods/clear_user_dataset.rb +0 -28
  101. data/lib/ftp_paradise/toplevel_methods/data.rb +0 -31
  102. data/lib/ftp_paradise/toplevel_methods/determine_user_dataset_from_this_hash.rb +0 -37
@@ -2,228 +2,169 @@
2
2
  # Encoding: UTF-8
3
3
  # frozen_string_literal: true
4
4
  # =========================================================================== #
5
- # require 'ftp_paradise/interactive_ftp/menu.rb'
5
+ # require 'ftp_paradise/shell/menu.rb'
6
6
  # =========================================================================== #
7
7
  module FtpParadise
8
8
 
9
- class InteractiveFtp
10
-
11
- require 'ftp_paradise/interactive_ftp/upload.rb'
12
-
13
- begin
14
- require 'verbose_truth'
15
- rescue LoadError; end
9
+ class Shell # === FtpParadise::Shell
16
10
 
17
11
  begin
18
- require 'rcfiles/requires/require_the_expand_cd_aliases.rb'
12
+ require 'rcfiles/directory_aliases/directory_aliases.rb'
19
13
  rescue LoadError; end
20
14
 
21
- require 'ftp_paradise/toplevel_methods/ftp_object.rb'
22
-
23
- # ========================================================================= #
24
- # === vte
25
- # ========================================================================= #
26
- def vt(i)
27
- VerboseTruth[i].to_s
28
- end
29
-
30
- # ========================================================================= #
31
- # === esystem
32
- # ========================================================================= #
33
- def esystem(i)
34
- e i
35
- system i
36
- end
37
-
38
15
  # ========================================================================= #
39
16
  # === menu (menu tag)
40
17
  #
41
- # Do note that @user_input will always be an Array.
18
+ # Take note that @internal_hash[:user_input] will always be an Array.
42
19
  # ========================================================================= #
43
20
  def menu(
44
- i = @user_input
21
+ i = user_input?
45
22
  )
46
23
  if i.is_a? Array
47
24
  i.each {|entry| menu(entry) }
48
25
  else
26
+ i = i.to_s.dup.strip
49
27
  # ===================================================================== #
50
28
  # Handle arguments first. We have to check if our input contains
51
29
  # any ' ' characters or not.
52
30
  # ===================================================================== #
53
31
  if i.include? ' '
54
- @splitted = i.split(' ')
55
- @first_argument = @splitted[1]
56
- @s = @second_argument = @splitted[2]
57
- @all_arguments = @splitted[1..-1] # This here does not contain the first argument.
58
- i = @splitted[0]
32
+ @internal_hash[:splitted] = i.split(' ')
33
+ @internal_hash[:first_argument] = @internal_hash[:splitted][1]
34
+ @internal_hash[:second_argument] = @internal_hash[:splitted][2]
35
+ @internal_hash[:all_arguments] = @internal_hash[:splitted][1..-1] # This here does not contain the first argument.
36
+ i = @internal_hash[:splitted][0]
59
37
  else
60
38
  # =================================================================== #
61
39
  # Reset again here so that we have a clean initial state.
62
40
  # =================================================================== #
63
41
  reset_instance_variables_that_hold_all_arguments
64
42
  end
65
- f = @first_argument
66
- case i # case tag
67
- # ===================================================================== #
68
- # === toshevy
69
- #
70
- # This is my "convenience" login.
71
- # ===================================================================== #
72
- when /^-?-?toshevy$/,
73
- /^-?-?shevy$/i,
74
- 'shev', # Login as shevy.
75
- 'iftp',
76
- 'remote'
77
- do_login_to_shevy_and_consider_showing_the_remote_files
78
- # ===================================================================== #
79
- # === uniwien_homepage
80
- # ===================================================================== #
81
- when /^-?-?uniwien(_|-)?homepage$/
82
- do_login(:uniwien_homepage)
83
- if SHOW_REMOTE_FILES_UPON_SUCCESSFUL_LOGIN
84
- show_remote_files :also_show_filesize # Also display this since as of March 2015.
85
- end
43
+ f = first_argument_for_the_menu_interface?
44
+ case i # (case tag)
86
45
  # ===================================================================== #
87
- # === login
88
- # ===================================================================== #
89
- when 'login',
90
- 'log',
91
- 'cto',
92
- 'con',
93
- 'connect_to',
94
- 'do_login',
95
- 'conn',
96
- 'connectto',
97
- 'connect2',
98
- /^-?-?do(_|-)?connect$/i,
99
- 'connect' # ← easier alias for now.
100
- do_login(f) { :be_verbose }
101
- # ===================================================================== #
102
- # === set_url
103
- # ===================================================================== #
104
- when /^-?-?set(_|-)?url$/i
105
- e 'Setting to the remote host called '+sfancy(f)+'.'
106
- set_url(f)
107
- # ===================================================================== #
108
- # === set_password
46
+ # === move_remote_file
109
47
  # ===================================================================== #
110
- when 'set_password',
111
- 'setpassword',
112
- 'password'
113
- set_password(f)
48
+ when /move_?remote_?file/,
49
+ 'rmv',
50
+ 'mmv',
51
+ 'remote_mv',
52
+ /remote(-|_)?move$/i,
53
+ /move(-|_)?remote$/i
54
+ move_remote_file(a?)
114
55
  # ===================================================================== #
115
- # === setname
56
+ # === remote_ls
116
57
  #
117
- # This entry point allows us to set the name of the user.
58
+ # This entry point will show which remote files exist.
118
59
  # ===================================================================== #
119
- when 'setname',
120
- 'set_name',
121
- 'set_user',
122
- 'setuser',
123
- 'set_user_name',
124
- 'username'
125
- set_name(f)
60
+ when 'remote_ls',
61
+ 'remotell',
62
+ 'listing',
63
+ 'lll',
64
+ 'lls',
65
+ 'llll',
66
+ 'remotecontent?',
67
+ '3l','show_remote_files','l?','listing?',
68
+ 'rls',
69
+ '3list',
70
+ 'rll',
71
+ 'remotels',
72
+ /remote_?listing/,
73
+ /remote(_|-)?host\??/,
74
+ 'showremotecontent',
75
+ 'showremote'
76
+ e "The remote file listing at #{sfancy(remote_host?)} is:"
77
+ show_remote_files
126
78
  # ===================================================================== #
127
- # === everything
128
- #
129
- # Can also be invoked via show_host_user_name_port_and_password.
79
+ # === is_file?
130
80
  # ===================================================================== #
131
- when 'everything',
132
- /show_?host_?user_?name_?port_?and_?password/,
133
- 'username?',
134
- 'uname?',
135
- 'user?'
136
- show_host_user_name_port_and_password
81
+ when /is_?file\??/
82
+ f = convert_number_to_file(f)
83
+ e ftp_connection?.is_file?(f).to_s
137
84
  # ===================================================================== #
138
- # === chmod
85
+ # === history
139
86
  # ===================================================================== #
140
- when 'chmod'
141
- filename = 'htop-2.2.0.tar.xz'
142
- try_to_chmod_this_remote_file(filename)
87
+ when 'history','history?'
88
+ show_history
143
89
  # ===================================================================== #
144
- # === remote_host?
90
+ # === cat
145
91
  # ===================================================================== #
146
- when /^remote(_|-)host\??/
147
- e sfancy(FtpParadise.remote_host?)
92
+ when 'cat'
93
+ display_file(f)
148
94
  # ===================================================================== #
149
- # === vim
95
+ # === time
150
96
  # ===================================================================== #
151
- when /^vim/
152
- esystem "vim #{f}"
97
+ when 'time','time?'
98
+ e return_time
153
99
  # ===================================================================== #
154
- # === set_editor
100
+ # === rcd
101
+ #
102
+ # This entry point allows us to change to a remote directory.
103
+ #
104
+ # Invocation example:
105
+ #
106
+ # rcd htdocs
155
107
  #
156
- # This entry point allows us to specify a different editor.
157
108
  # ===================================================================== #
158
- when /^set(-|_| )?editor$/ # === set_editor vim
159
- set_editor(f)
109
+ when 'rcd',
110
+ /^-?-?remote(-|_| )?change(-|_| )?directory$/,
111
+ 'rchange_dir','lcd','remotecd','rc','remote_cd'
112
+ remote_change_directory(f, :show_remote_file_listing)
160
113
  # ===================================================================== #
161
- # === editor?
114
+ # === show_user_and_password
162
115
  # ===================================================================== #
163
- when 'editor?',
164
- /^report(-|_| )?which(-|_| )?editor(-|_| )?is(-|_| )?in(-|_| )?use$/i
165
- report_which_editor_is_in_use
116
+ when /show_?user_?and_?password/
117
+ show_user_and_password
166
118
  # ===================================================================== #
167
- # === edit
119
+ # === show_hosts
168
120
  # ===================================================================== #
169
- when 'edit',
170
- 'bluefish',
171
- 'bl',
172
- 'open',
173
- /^open(-|_| )?this(-|_| )?file(-|_| )?in(-|_| )?editor$/,
174
- 'open?'
175
- open_this_file_in_editor(f)
121
+ when /^-?-?show_?hosts/,'hosts?'
122
+ show_hosts
176
123
  # ===================================================================== #
177
- # === binary_upload
124
+ # === download_binary_file
178
125
  # ===================================================================== #
179
- when /^binary(-|_| )?upload$/,
180
- /^upload(-|_| )?binary$/,
181
- 'bupload',
182
- do_use_binary_mode
183
- upload(f)
126
+ when 'download_binary_file','downloadbinaryfile',
127
+ 'getbinaryfile'
128
+ ftp_connection?.download_binary_file(f)
184
129
  # ===================================================================== #
185
- # === upload_this_file
186
- #
187
- # This entry point allows us to upload a local file to a remote
188
- # host.
189
- #
190
- # Invocation example:
191
- #
192
- # upload /Depot/j/test.md
193
- #
130
+ # === local_files
194
131
  # ===================================================================== #
195
- when /^-?-?upload(-|_| )?this(-|_| )?file$/,
196
- 'upload',
197
- 'upoad',
198
- 'upl',
199
- 'up',
200
- 'icopy', # copy all from local to remote dir
201
- 'uload'
202
- upload(@all_arguments) # bl $FTP_PARADISE/
132
+ when 'local_files','localfiles'
133
+ show_local_files(true) # true for dirs-only.
203
134
  # ===================================================================== #
204
- # === iftp download
205
- #
206
- # This entry point allows us to download a remote file, via
207
- # ruby's FTP interface.
135
+ # === set
208
136
  # ===================================================================== #
209
- when /^-?-?download$/,'get','down','do','dow','dload','dl',
210
- 'wget','wg'
211
- download_remote_file(f)
137
+ when 'set','set_file','setfile','file','assign'
138
+ if @internal_hash[:first_argument].to_s =~ /^\d+/ # upload only a specific number.
139
+ @internal_hash[:first_argument] = Dir['*'][@internal_hash[:first_argument].to_i + 1]
140
+ end
141
+ if be_verbose
142
+ e "Setting @internal_hash[:file] to `#{sfile(file?)}` now."
143
+ end
144
+ set_file(f)
212
145
  # ===================================================================== #
213
- # === remote_dirs?
146
+ # === uniwien_homepage
214
147
  # ===================================================================== #
215
- when 'remote_dirs?','dirs?','dir?','dir','dirs','onlydirs',
216
- 'remotedirs?',
217
- /^-?-?show(-|_| )?remote(-|_| )?directories$/
218
- show_remote_directories
148
+ when /^-?-?uniwien(_|-)?homepage$/
149
+ do_login(:uniwien_homepage)
150
+ if SHOW_REMOTE_FILES_UPON_SUCCESSFUL_LOGIN
151
+ show_remote_files :also_show_filesize # Also display this since as of March 2015.
152
+ end
219
153
  # ===================================================================== #
220
- # === rpwd
154
+ # === login
221
155
  # ===================================================================== #
222
- when 'rpwd',
223
- /^remote(-|_| )?pwd/,
224
- 'remote_pwd?','remote_path?','remote_dir?','rdir',
225
- 'lpwd','rpwd?','rcd?'
226
- report_remote_directory
156
+ when 'login',
157
+ 'log',
158
+ 'cto',
159
+ 'con',
160
+ 'connect_to',
161
+ 'do_login',
162
+ 'conn',
163
+ 'connectto',
164
+ 'connect2',
165
+ /^-?-?do(_|-)?connect$/i,
166
+ 'connect' # ← easier alias for now.
167
+ do_login(f) { :be_verbose }
227
168
  # ===================================================================== #
228
169
  # === upload_directory
229
170
  # ===================================================================== #
@@ -236,18 +177,21 @@ class InteractiveFtp
236
177
  # holds our remote connection.
237
178
  # ===================================================================== #
238
179
  when /^raw(_|-)?list$/
239
- pp ftp?.raw_list
180
+ pp ftp_connection?.raw_list
240
181
  # ===================================================================== #
241
182
  # === raw
242
183
  # ===================================================================== #
243
184
  when 'raw','@array_file_listing','array_file_listing',
244
185
  'l1','list_content','raw?'
245
- pp ftp?.array_file_listing
186
+ pp ftp_connection?.array_file_listing
246
187
  # ===================================================================== #
247
188
  # === remote_remove
248
189
  # ===================================================================== #
249
190
  when 'remote_remove','rrmdir','remove_remote_directory','removeremove',
250
- 'rremove','rrmfile','rrm','remove_remote','remote_rm','remoterm',
191
+ 'rremove',
192
+ 'rrmfile','rrm','remove_remote',
193
+ 'remote_rm',
194
+ 'remoterm',
251
195
  'remove_remote_file',
252
196
  'rrem',
253
197
  'removeremotedirectory',
@@ -262,34 +206,15 @@ class InteractiveFtp
262
206
  'deldir'
263
207
  _ = a?
264
208
  if user_input?.first.include?(' ') and
265
- _.last.end_with?('.pdf','.pdf"') # <-- Yup, hackish. For now we only make an exception for .pdf files.
209
+ _.last.end_with?('.pdf','.pdf"') # ←- Yup, hackish. For now we only make an exception for .pdf files.
266
210
  _ = _.join(' ')
267
211
  end
268
212
  remote_remove(_)
269
213
  # ===================================================================== #
270
- # === nlst
271
- # ===================================================================== #
272
- when 'nlst','nls','nlst?'
273
- e ftp?.nlst
274
- # ===================================================================== #
275
- # === list?
276
- # ===================================================================== #
277
- when 'list?','list'
278
- pp ftp?.list?
279
- # ===================================================================== #
280
- # === q
281
- # ===================================================================== #
282
- when *ARRAY_VALID_OPTIONS_FOR_EXITING_THE_SHELL, :break
283
- :break # quit tag
284
- # ===================================================================== #
285
- # === @_
286
- # ===================================================================== #
287
- when '@_','@_?','__','ftp?','ftp_object?','ftpobject?'
288
- pp ftp?
289
- # ===================================================================== #
290
214
  # === FtpParadise.dataset?
291
215
  # ===================================================================== #
292
- when 'FtpParadise.dataset?','dataset?'
216
+ when 'FtpParadise.dataset?',
217
+ 'dataset?'
293
218
  pp FtpParadise.dataset?
294
219
  # ===================================================================== #
295
220
  # === ll
@@ -302,95 +227,80 @@ class InteractiveFtp
302
227
  'local','l'
303
228
  show_local_entries
304
229
  # ===================================================================== #
305
- # === remote_ls
306
- #
307
- # This entry point will show which remote files exist.
308
- # ===================================================================== #
309
- when 'remote_ls',
310
- 'remotell',
311
- 'listing',
312
- 'lll',
313
- 'lls',
314
- 'llll',
315
- 'remotecontent?',
316
- '3l','show_remote_files','l?','listing?',
317
- 'rls',
318
- '3list',
319
- 'rll',
320
- 'remotels',
321
- /remote_?listing/,
322
- 'showremotecontent','showremote'
323
- e "The remote file listing at #{sfancy(remote_host?)} is:"
324
- show_remote_files
325
- # ===================================================================== #
326
- # === rcd
327
- #
328
- # This entry point allows us to change to a remote directory.
329
- #
330
- # Invocation example:
331
- #
332
- # rcd htdocs
333
- #
334
- # ===================================================================== #
335
- when 'rcd',
336
- /^-?-?remote(-|_| )?change(-|_| )?directory$/,
337
- 'rchange_dir','lcd','remotecd','rc','remote_cd'
338
- remote_change_directory(f, :show_remote_file_listing)
339
- # ===================================================================== #
340
- # === anonymous
341
- # ===================================================================== #
342
- when 'anonymous','anon'
343
- enable_anonymous_login
344
- # ===================================================================== #
345
- # === port?
346
- # ===================================================================== #
347
- when 'port?', /report_?port/
348
- report_port
349
- # ===================================================================== #
350
- # === mode?
230
+ # === set_url
351
231
  # ===================================================================== #
352
- when 'mode?','mode','transfermode?'
353
- e 'The mode for InteractiveFtp is: '+sfancy(@mode.to_s)
232
+ when /^-?-?set(_|-)?url$/i
233
+ e 'Setting to the remote host called '+sfancy(f)+'.'
234
+ set_url(f)
354
235
  # ===================================================================== #
355
- # === show_user_and_password
236
+ # === set_password
356
237
  # ===================================================================== #
357
- when /show_?user_?and_?password/
358
- show_user_and_password
238
+ when 'set_password',
239
+ 'setpassword',
240
+ 'password'
241
+ set_password(f)
359
242
  # ===================================================================== #
360
- # === show_hosts
243
+ # === toshevy
244
+ #
245
+ # This is my "convenience" login.
361
246
  # ===================================================================== #
362
- when /^-?-?show_?hosts/,'hosts?'
363
- show_hosts
247
+ when /^-?-?toshevy$/,
248
+ /^-?-?shevy$/i,
249
+ 'shev', # Login as shevy.
250
+ 'iftp',
251
+ 'remote'
252
+ do_login_to_shevy_and_consider_showing_the_remote_files
364
253
  # ===================================================================== #
365
- # === move_remote_file
254
+ # === iftp download
255
+ #
256
+ # This entry point allows us to download a remote file, via
257
+ # ruby's FTP interface.
366
258
  # ===================================================================== #
367
- when /move_?remote_?file/,'rmv','mmv','remote_mv'
368
- move_remote_file(a)
259
+ when /^-?-?download$/,
260
+ 'get',
261
+ 'down',
262
+ 'do',
263
+ 'dow',
264
+ 'dload',
265
+ 'dl',
266
+ 'wget',
267
+ 'wg'
268
+ download_remote_file(f)
369
269
  # ===================================================================== #
370
- # === download_binary_file
270
+ # === rpwd
371
271
  # ===================================================================== #
372
- when 'download_binary_file','downloadbinaryfile',
373
- 'getbinaryfile'
374
- ftp?.download_binary_file(f)
272
+ when 'rpwd',
273
+ /^remote(-|_| )?pwd/,
274
+ 'remote_pwd?',
275
+ 'remote_path?',
276
+ 'remote_dir?',
277
+ 'rdir',
278
+ 'lpwd',
279
+ 'rpwd?',
280
+ 'rcd?'
281
+ report_remote_directory
375
282
  # ===================================================================== #
376
- # === file?
283
+ # === nlst
377
284
  # ===================================================================== #
378
- when 'file?','upload?','f?'
379
- consider_reporting_file
285
+ when 'nlst','nls','nlst?'
286
+ e ftp_connection?.nlst
380
287
  # ===================================================================== #
381
- # === www
288
+ # === list?
382
289
  # ===================================================================== #
383
- when 'www','sinatra','show_www_component','www?'
384
- show_www_component
290
+ when 'list?','list'
291
+ pp ftp_connection?.list?
385
292
  # ===================================================================== #
386
293
  # === binary?
387
294
  # ===================================================================== #
388
295
  when 'binary?'
389
- e vt(@mode == :binary)
296
+ e vt(ftp_transfer_mode? == :binary)
390
297
  # ===================================================================== #
391
298
  # === is_directory?
392
299
  # ===================================================================== #
393
- when 'is_directory?','isdirectory?','isdir?','is_a_directory?'
300
+ when 'is_directory?',
301
+ 'isdirectory?',
302
+ 'isdir?',
303
+ 'is_a_directory?'
394
304
  e is_dir(f).to_s
395
305
  # ===================================================================== #
396
306
  # === active
@@ -410,7 +320,8 @@ class InteractiveFtp
410
320
  # ===================================================================== #
411
321
  # === stat
412
322
  # ===================================================================== #
413
- when 'stat','stat?'
323
+ when 'stat',
324
+ 'stat?'
414
325
  stat_remote_file(f)
415
326
  # ===================================================================== #
416
327
  # === a1?
@@ -435,7 +346,11 @@ class InteractiveFtp
435
346
  # ===================================================================== #
436
347
  # === info
437
348
  # ===================================================================== #
438
- when 'info','debug','deb','debug_it','debugit'
349
+ when 'info',
350
+ 'debug',
351
+ 'deb',
352
+ 'debug_it',
353
+ 'debugit'
439
354
  debug_it
440
355
  # ===================================================================== #
441
356
  # === show_full_names
@@ -447,223 +362,372 @@ class InteractiveFtp
447
362
  'show_names'
448
363
  toggle_show_full_names
449
364
  # ===================================================================== #
450
- # === base_dir?
365
+ # === available?
451
366
  # ===================================================================== #
452
- when 'base_dir?','basedir?'
453
- e PROJECT_BASE_DIRECTORY
367
+ when 'available?','show_available_connections'
368
+ show_available_connections
454
369
  # ===================================================================== #
455
- # === config?
370
+ # === localdir?
456
371
  # ===================================================================== #
457
- when 'config?','configuration?','ccc','config'
458
- display_configuration_options
459
- pp @config
372
+ when 'localdir?','ldir'
373
+ report_local_dir
460
374
  # ===================================================================== #
461
- # === local_files
375
+ # === yaml?
462
376
  # ===================================================================== #
463
- when 'local_files','localfiles'
464
- show_local_files(true) # true for dirs-only.
377
+ when 'yaml?'
378
+ show_ftp_yaml_file
465
379
  # ===================================================================== #
466
- # === set
380
+ # === remove_local
467
381
  # ===================================================================== #
468
- when 'set','set_file','setfile','file','assign'
469
- if @first_argument.to_s =~ /^\d+/ # upload only a specific number.
470
- @first_argument = Dir['*'][@first_argument.to_i + 1]
471
- end
472
- set_file(f)
473
- e "Setting @file to `#{sfile(file?)}` now." if be_verbose
382
+ when 'remove_local',
383
+ 'delete',
384
+ 'rm',
385
+ 'remove',
386
+ 'rem'
387
+ remove_local(f)
474
388
  # ===================================================================== #
475
- # === available?
389
+ # === status?
476
390
  # ===================================================================== #
477
- when 'available?','show_available_connections'
478
- show_available_connections
391
+ when 'status?',
392
+ 'info?',
393
+ 'stats?',
394
+ 's?',
395
+ 'status'
396
+ show_status
479
397
  # ===================================================================== #
480
- # === toggle2
398
+ # === remotemkdir
481
399
  # ===================================================================== #
482
- when 'toggle2','toggle_modes','togglemodes','t2' # toggle the mode.
483
- toggle_modes
400
+ when 'rmkdir',
401
+ 'remote_mkdir',
402
+ 'remotemkdir',
403
+ 'mkdir_remote'
404
+ create_remote_directory(f)
484
405
  # ===================================================================== #
485
- # === last
406
+ # === touch
486
407
  # ===================================================================== #
487
- when 'last'
488
- last_action = @history.last
489
- check_against_menu(last_action)
408
+ when 'touch'
409
+ create_file(f)
490
410
  # ===================================================================== #
491
- # === localdir?
411
+ # === dated?
492
412
  # ===================================================================== #
493
- when 'localdir?','ldir'
494
- report_local_dir
413
+ when 'dated?','dated'
414
+ show_date_sorted_entries
495
415
  # ===================================================================== #
496
- # === binary
416
+ # === help
497
417
  # ===================================================================== #
498
- when 'binary'
499
- use_binary_mode(true)
418
+ when /help/
419
+ show_help
500
420
  # ===================================================================== #
501
- # === yaml?
421
+ # === list2
502
422
  # ===================================================================== #
503
- when 'yaml?'
504
- show_ftp_yaml_file
423
+ when 'list2','rlist' # Debug here.
424
+ ftp_connection?.list
505
425
  # ===================================================================== #
506
- # === remove_local
426
+ # === date?
507
427
  # ===================================================================== #
508
- when 'remove_local','delete','rm','remove','rem'
509
- remove_local(f)
428
+ when 'date?','date'
429
+ e return_time+' '+return_date
430
+ # ===================================================================== #
431
+ # === welcome
432
+ # ===================================================================== #
433
+ when 'welcome','show_welcome_message','welcome?','welc'
434
+ show_ftp_server_welcome
435
+ # ===================================================================== #
436
+ # === show_ftp_docu
437
+ # ===================================================================== #
438
+ when 'show_ftp_docu','ftp_docu?','docu?','ftp_docu'
439
+ show_ftp_docu
440
+ # ===================================================================== #
441
+ # === enable_readline
442
+ # ===================================================================== #
443
+ when /^-?-?enable(_|-)?readline$/
444
+ enable_readline
445
+ # ===================================================================== #
446
+ # === disconnect
447
+ # ===================================================================== #
448
+ when 'disconnect','dconnect','out'
449
+ disconnect
450
+ # ===================================================================== #
451
+ # === last_response?
452
+ # ===================================================================== #
453
+ when 'last_response?','last_response','lastresponse','lastresponse?',
454
+ 'lastconnected','laststatus'
455
+ report_last_response
456
+ # ===================================================================== #
457
+ # === readline?
458
+ # ===================================================================== #
459
+ when 'readline?'
460
+ e verbose_truth(use_readline?)
461
+ # ===================================================================== #
462
+ # === iftp --no-readline
463
+ # ===================================================================== #
464
+ when /^-?-?no(-|_)?readline$/,
465
+ /^-?-?do(-|_| )?not(-|_| )?use(-|_| )?readline$/
466
+ do_not_use_readline
467
+ # ===================================================================== #
468
+ # === datafile?
469
+ # ===================================================================== #
470
+ when 'datafile?'
471
+ e datafile?
472
+ # ===================================================================== #
473
+ # === delete
474
+ #
475
+ # Invocation example:
476
+ #
477
+ # delete files for your website should be uploaded here!
478
+ #
479
+ # ===================================================================== #
480
+ when /^-?-?delete$/,
481
+ /^-?-?del$/
482
+ remote_remove_file(all_arguments?.join(' ').strip)
483
+ # ===================================================================== #
484
+ # === quiet
485
+ # ===================================================================== #
486
+ when 'quiet','be_quiet'
487
+ ConvertGlobalEnv.be_quiet # So that it will be silent.
488
+ # ===================================================================== #
489
+ # === password?
490
+ # ===================================================================== #
491
+ when 'password?',
492
+ 'pw?'
493
+ e password?
494
+ # ===================================================================== #
495
+ # === rename
496
+ # ===================================================================== #
497
+ when 'rename','remote_rename','remoterename','remotemv'
498
+ rename(f?, s?)
499
+ # ===================================================================== #
500
+ # === remote_remove
501
+ # ===================================================================== #
502
+ when 'mv','move_file','movefile','move_lovel_file'
503
+ move_local_file(f, s?)
504
+ # ===================================================================== #
505
+ # === last?
506
+ # ===================================================================== #
507
+ when 'last?'
508
+ e history?.last
509
+ # ===================================================================== #
510
+ # === base_dir?
511
+ # ===================================================================== #
512
+ when 'base_dir?','basedir?'
513
+ e PROJECT_BASE_DIRECTORY
514
+ # ===================================================================== #
515
+ # === config?
516
+ # ===================================================================== #
517
+ when 'config?','configuration?','ccc','config'
518
+ display_configuration_options
519
+ pp config?
520
+ # ===================================================================== #
521
+ # === colours?
522
+ # ===================================================================== #
523
+ when 'colours?','show_colours'
524
+ e 'Will we use colours: '+
525
+ vt(use_colours?)
526
+ show_colours
527
+ # ===================================================================== #
528
+ # === toggle
529
+ # ===================================================================== #
530
+ when 'toggle'
531
+ toggle(f)
510
532
  # ===================================================================== #
511
533
  # === site?
512
534
  # ===================================================================== #
513
535
  when 'site?'
514
- e ftp?.site
515
- # ===================================================================== #
516
- # === mdtm
517
- # ===================================================================== #
518
- when 'mdtm','modtime?','modtime','modification_time_of?',
519
- 'show_modtime_of','showmodtimeof','mtime?' # mtime? is probably only temporary.
520
- show_modtime_of(f)
536
+ e ftp_connection?.site
521
537
  # ===================================================================== #
522
538
  # === downloaded?
523
539
  # ===================================================================== #
524
540
  when 'downloaded?'
525
541
  show_which_files_we_did_download_so_far
526
542
  # ===================================================================== #
527
- # === set_login
528
- # ===================================================================== #
529
- when /set_?login/,'login='
530
- set_login(a?)
531
- # ===================================================================== #
532
543
  # === cd
533
544
  # ===================================================================== #
534
- when 'cd','change_dir'
545
+ when 'cd',
546
+ /^change(-|_| )?dir/
535
547
  change_directory(f)
536
548
  # ===================================================================== #
537
- # === status?
549
+ # === mkdir
538
550
  # ===================================================================== #
539
- when 'status?','info?','stats?','s?','status'
540
- show_status
551
+ when 'mkdir'
552
+ create_directory(f, :be_verbose)
541
553
  # ===================================================================== #
542
- # === connected_to?
554
+ # === anonymous
543
555
  # ===================================================================== #
544
- when 'connected?','c?','remote?','host?',
545
- 'connected_to?','url?','cto?','?'
546
- connected_to?
556
+ when 'anonymous',
557
+ 'anon'
558
+ enable_anonymous_login
547
559
  # ===================================================================== #
548
- # === remotemkdir
560
+ # === port?
549
561
  # ===================================================================== #
550
- when 'rmkdir','remote_mkdir','remotemkdir','mkdir_remote'
551
- create_remote_directory(f)
562
+ when 'port?', /report_?port/
563
+ report_port
552
564
  # ===================================================================== #
553
- # === is_file?
565
+ # === mode?
554
566
  # ===================================================================== #
555
- when /is_?file\??/
556
- f = convert_number_to_file(f)
557
- e ftp?.is_file?(f).to_s
558
- # ===================================================================== #
559
- # === change
567
+ when 'mode?','mode','transfermode?'
568
+ e 'The mode for InteractiveFtp is: '+
569
+ sfancy(ftp_transfer_mode?.to_s)
560
570
  # ===================================================================== #
561
- when 'change'
562
- change @first_argument
571
+ # == set_port
563
572
  # ===================================================================== #
564
- # === full
573
+ when 'set_port','setport','port'
574
+ set_port(f) # setport 33791
565
575
  # ===================================================================== #
566
- when 'full'
567
- e 'We will show the full path.'
568
- do_show_full_names
576
+ # === debug?
569
577
  # ===================================================================== #
570
- # === full_names?
578
+ when 'debug?'
579
+ e verbose_truth(config?.debug.to_s)
580
+ ftp_connection?.status?
571
581
  # ===================================================================== #
572
- when 'full_names?','full?','names?','name?','fullnames?',
573
- 'full_path?','fullpath?'
574
- will_we_show_full_names
582
+ # === file?
575
583
  # ===================================================================== #
576
- # === rename
584
+ when 'file?',
585
+ 'upload?',
586
+ 'f?'
587
+ consider_reporting_file
577
588
  # ===================================================================== #
578
- when 'rename','remote_rename','remoterename','remotemv'
579
- rename(f?, @s)
589
+ # === www
580
590
  # ===================================================================== #
581
- # === remote_remove
591
+ when 'www','sinatra','show_www_component','www?'
592
+ show_www_component
582
593
  # ===================================================================== #
583
- when 'mv','move_file','movefile','move_lovel_file'
584
- move_local_file(f, @s)
594
+ # === setname
595
+ #
596
+ # This entry point allows us to set the name of the user.
585
597
  # ===================================================================== #
586
- # === last?
598
+ when /^set(-|_| )?name/i,
599
+ 'set_user',
600
+ 'setuser',
601
+ 'set_user_name',
602
+ 'username'
603
+ set_name(f)
587
604
  # ===================================================================== #
588
- when 'last?'
589
- e @history.last
605
+ # === chmod
590
606
  # ===================================================================== #
591
- # === history
607
+ when 'chmod'
608
+ filename = 'htop-2.2.0.tar.xz'
609
+ try_to_chmod_this_remote_file(filename)
592
610
  # ===================================================================== #
593
- when 'history','history?'
594
- show_history
611
+ # === editor?
595
612
  # ===================================================================== #
596
- # === cat
613
+ when 'editor?',
614
+ /^report(-|_| )?which(-|_| )?editor(-|_| )?is(-|_| )?in(-|_| )?use$/i
615
+ report_which_editor_is_in_use
597
616
  # ===================================================================== #
598
- when 'cat'
599
- display_file(f)
617
+ # === upload_this_file
618
+ #
619
+ # This entry point allows us to upload a local file to a remote
620
+ # host.
621
+ #
622
+ # Invocation example:
623
+ #
624
+ # upload /Depot/j/test.md
625
+ #
600
626
  # ===================================================================== #
601
- # === touch
627
+ when /^-?-?upload(-|_| )?this(-|_| )?file$/,
628
+ 'upload',
629
+ 'upoad',
630
+ 'upl',
631
+ 'up',
632
+ 'icopy', # copy all from local to remote dir
633
+ 'uload'
634
+ upload(all_arguments?) # bl $FTP_PARADISE/
602
635
  # ===================================================================== #
603
- when 'touch'
604
- create_file(f)
636
+ # === everything
637
+ #
638
+ # Can also be invoked via show_host_user_name_port_and_password.
605
639
  # ===================================================================== #
606
- # === mkdir
640
+ when 'everything',
641
+ /show_?host_?user_?name_?port_?and_?password/,
642
+ 'username?',
643
+ 'uname?',
644
+ 'user?'
645
+ show_host_user_name_port_and_password
607
646
  # ===================================================================== #
608
- when 'mkdir'
609
- create_directory(f, :be_verbose)
647
+ # === change
610
648
  # ===================================================================== #
611
- # == set_port
649
+ when 'change'
650
+ change first_argument?
612
651
  # ===================================================================== #
613
- when 'set_port','setport','port'
614
- set_port(f) # setport 33791
652
+ # === full
615
653
  # ===================================================================== #
616
- # === debug?
654
+ when 'full'
655
+ e 'We will show the full path.'
656
+ do_show_full_names
617
657
  # ===================================================================== #
618
- when 'debug?'
619
- e verbose_truth(@config.debug.to_s)
620
- ftp?.status?
658
+ # === full_names?
621
659
  # ===================================================================== #
622
- # === help?
660
+ when 'full_names?','full?','names?','name?','fullnames?',
661
+ 'full_path?','fullpath?'
662
+ will_we_show_full_names
623
663
  # ===================================================================== #
624
- when *ARRAY_HELP_OPTIONS
625
- show_help
664
+ # === toggle2
626
665
  # ===================================================================== #
627
- # === dated?
666
+ when 'toggle2','toggle_modes','togglemodes','t2' # toggle the mode.
667
+ toggle_modes
628
668
  # ===================================================================== #
629
- when 'dated?','dated'
630
- show_date_sorted_entries
669
+ # === last
631
670
  # ===================================================================== #
632
- # === date?
671
+ when 'last'
672
+ last_action = history?.last
673
+ check_against_menu(last_action)
633
674
  # ===================================================================== #
634
- when 'date?','date'
635
- e return_time+' '+return_date
675
+ # === edit
636
676
  # ===================================================================== #
637
- # === welcome
677
+ when 'edit',
678
+ 'bluefish',
679
+ 'bl',
680
+ 'open',
681
+ /^open(-|_| )?this(-|_| )?file(-|_| )?in(-|_| )?editor$/,
682
+ 'open?'
683
+ open_this_file_in_editor(f)
638
684
  # ===================================================================== #
639
- when 'welcome','show_welcome_message','welcome?','welc'
640
- show_ftp_server_welcome
685
+ # === binary_upload
641
686
  # ===================================================================== #
642
- # === show_ftp_docu
687
+ when /^binary(-|_| )?upload$/,
688
+ /^upload(-|_| )?binary$/,
689
+ 'bupload',
690
+ do_use_binary_mode
691
+ upload(f)
643
692
  # ===================================================================== #
644
- when 'show_ftp_docu','ftp_docu?','docu?','ftp_docu'
645
- show_ftp_docu
693
+ # === remote_host?
646
694
  # ===================================================================== #
647
- # === enable_readline
695
+ when /^remote(_|-)host\??/
696
+ e sfancy(FtpParadise.remote_host?)
648
697
  # ===================================================================== #
649
- when /^-?-?enable(_|-)?readline$/
650
- enable_readline
698
+ # === vim
651
699
  # ===================================================================== #
652
- # === disconnect
700
+ when /^vim/
701
+ esystem "vim #{f}"
653
702
  # ===================================================================== #
654
- when 'disconnect','dconnect','out'
655
- disconnect
703
+ # === set_editor
704
+ #
705
+ # This entry point allows us to specify a different editor.
656
706
  # ===================================================================== #
657
- # === toggle
707
+ when /^set(-|_| )?editor$/ # === set_editor vim
708
+ set_editor(f)
658
709
  # ===================================================================== #
659
- when 'toggle'
660
- toggle(f)
710
+ # === binary
661
711
  # ===================================================================== #
662
- # === colours?
712
+ when 'binary'
713
+ use_binary_mode(true)
663
714
  # ===================================================================== #
664
- when 'colours?','show_colours'
665
- e 'Will we use colours: '+vt(use_colours?)
666
- show_colours
715
+ # === set_login
716
+ # ===================================================================== #
717
+ when /set_?login/,
718
+ 'login='
719
+ set_login(a?)
720
+ # ===================================================================== #
721
+ # === mdtm
722
+ # ===================================================================== #
723
+ when 'mdtm',
724
+ 'modtime?',
725
+ 'modtime',
726
+ 'modification_time_of?',
727
+ 'show_modtime_of',
728
+ 'showmodtimeof',
729
+ 'mtime?' # mtime? is probably only temporary.
730
+ show_modtime_of(f)
667
731
  # ===================================================================== #
668
732
  # === nofull
669
733
  # ===================================================================== #
@@ -674,15 +738,10 @@ class InteractiveFtp
674
738
  # === last_response_code?
675
739
  # ===================================================================== #
676
740
  when 'last_response_code?','last_response_code','lastresponsecode',
677
- 'lastresponsecode?','report_last_response_code'
741
+ 'lastresponsecode?',
742
+ 'report_last_response_code'
678
743
  report_last_response_code
679
744
  # ===================================================================== #
680
- # === last_response?
681
- # ===================================================================== #
682
- when 'last_response?','last_response','lastresponse','lastresponse?',
683
- 'lastconnected','laststatus'
684
- report_last_response
685
- # ===================================================================== #
686
745
  # === noop
687
746
  # ===================================================================== #
688
747
  when 'noop'
@@ -691,40 +750,35 @@ class InteractiveFtp
691
750
  # ===================================================================== #
692
751
  # === pwd
693
752
  # ===================================================================== #
694
- when 'pwd','pwd?','pw'
753
+ when 'pwd',
754
+ 'pwd?',
755
+ 'pw'
695
756
  report_local_directory
696
757
  # ===================================================================== #
697
- # === readline?
698
- # ===================================================================== #
699
- when 'readline?'
700
- e verbose_truth(use_readline?)
701
- # ===================================================================== #
702
- # === iftp --no-readline
703
- # ===================================================================== #
704
- when /^-?-?no(-|_)?readline$/,
705
- /^-?-?do(-|_| )?not(-|_| )?use(-|_| )?readline$/
706
- do_not_use_readline
707
- # ===================================================================== #
708
- # === datafile?
758
+ # === coloured_remote_host?
709
759
  # ===================================================================== #
710
- when 'datafile?'
711
- e datafile?
760
+ when 'coloured_remote_host?'
761
+ e coloured_remote_host?
712
762
  # ===================================================================== #
713
- # === delete
714
- #
715
- # Invocation example:
716
- # delete files for your website should be uploaded here!
763
+ # === connected_to?
717
764
  # ===================================================================== #
718
- when /^-?-?delete$/,
719
- /^-?-?del$/
720
- remote_remove_file(@all_arguments.join(' ').strip)
765
+ when 'connected?','c?',
766
+ 'remote?',
767
+ 'host?',
768
+ 'connected_to?',
769
+ 'url?',
770
+ 'cto?',
771
+ '?'
772
+ connected_to?
721
773
  # ===================================================================== #
722
774
  # === remote_remove_file
723
775
  #
724
776
  # This entry point allows us to remove a (or several) remote file(s).
725
777
  #
726
778
  # Usage example:
779
+ #
727
780
  # rcd htdocs; remote-remove index2.html
781
+ #
728
782
  # ===================================================================== #
729
783
  when /^-?-?remote(-|_| )?remove(-|_| )?files?$/,
730
784
  /^-?-?remote(-|_| )?remove$/
@@ -736,50 +790,102 @@ class InteractiveFtp
736
790
  /^-?-?remote(-|_| )?mkdir$/
737
791
  remote_create_directory(a?)
738
792
  # ===================================================================== #
739
- # === quiet
793
+ # === version?
740
794
  # ===================================================================== #
741
- when 'quiet','be_quiet'
742
- ConvertGlobalEnv.be_quiet # So that it will be silent.
795
+ when 'version?',
796
+ /^report(_|-)?version/
797
+ report_version
743
798
  # ===================================================================== #
744
- # === password?
799
+ # === ''
745
800
  # ===================================================================== #
746
- when 'password?',
747
- 'pw?'
748
- e password?
801
+ when ''
802
+ e
803
+ display_prompt
749
804
  # ===================================================================== #
750
- # === help
805
+ # === help?
751
806
  # ===================================================================== #
752
- when /help/
807
+ when *ARRAY_HELP_OPTIONS
753
808
  show_help
754
809
  # ===================================================================== #
755
- # === list2
810
+ # === remote_dirs?
756
811
  # ===================================================================== #
757
- when 'list2','rlist' # Debug here.
758
- ftp?.list
812
+ when 'remote_dirs?',
813
+ 'dirs?',
814
+ 'dir?',
815
+ 'dir',
816
+ 'dirs',
817
+ 'onlydirs',
818
+ 'remotedirs?',
819
+ /^-?-?show(-|_| )?remote(-|_| )?directories$/
820
+ show_remote_directories
759
821
  # ===================================================================== #
760
- # === time
822
+ # === remote_ls
761
823
  # ===================================================================== #
762
- when 'time','time?'
763
- e return_time
824
+ when /^-?-?remote(-|_)?ls/,
825
+ /^-?-?ls/
826
+ cliner_seagreen
827
+ connection?.show_remote_files
828
+ cliner_seagreen
764
829
  # ===================================================================== #
765
- # === version?
830
+ # === connection?
766
831
  # ===================================================================== #
767
- when 'version?',/^report(_|-)?version/
768
- report_version
769
- else # else tag.
770
- _ = Rcfiles::ExpandCdAliases.new(i) # To expand our cd-aliases.
771
- if _._ # If we have found it.
772
- change_directory(_._) # My cd-aliases go in here.
832
+ when /^-?-?connection\??/,
833
+ '@_','@_?',
834
+ '__',
835
+ 'ftp?',
836
+ 'ftp_object?',
837
+ 'ftpobject?'
838
+ pp connection?
839
+ # ===================================================================== #
840
+ # === nlst
841
+ # ===================================================================== #
842
+ when /^-?-?nlst\??/
843
+ connection?.nlst?
844
+ # ===================================================================== #
845
+ # === remote_status?
846
+ # ===================================================================== #
847
+ when /^-?-?remote(-|_)?status\??/
848
+ e 'The remote status is:'
849
+ e
850
+ connection?.remote_status?
851
+ e
852
+ # ===================================================================== #
853
+ # === info?
854
+ # ===================================================================== #
855
+ when /^-?-?info\??/
856
+ pp FtpParadise.info?
857
+ # ===================================================================== #
858
+ # === exit (quit tag)
859
+ #
860
+ # Use this entry point to quit from the interactive FTP-shell again.
861
+ # ===================================================================== #
862
+ when *ARRAY_VALID_OPTIONS_FOR_EXITING_THE_SHELL,
863
+ :break
864
+ @internal_hash[:may_we_exit] = true
865
+ else # else tag
866
+ if Rcfiles::DirectoryAliases.is_included?(i)
867
+ target_directory = Rcfiles::DirectoryAliases[i]
868
+ if File.directory? target_directory
869
+ change_directory(target_directory) # My cd-aliases go in here.
870
+ end
773
871
  elsif i =~ /^\d+$/
774
872
  remote_cd(i) # perform a remote cd here.
775
- elsif i[0,1] == '?' # If has leading '?'
873
+ elsif i.start_with?('?') # If has leading '?'
776
874
  stat_remote_file(i[1..-1])
777
875
  else
876
+ e 'Unknown command instruction: '+
877
+ steelblue(i)
778
878
  display_prompt # Else display the prompt by default.
779
879
  end
880
+ # e steelblue('The user input was: ')+
881
+ # tomato(i) unless i.empty?
882
+ # ^^^^ what to do with this here?
780
883
  end
884
+ # ===================================================================== #
885
+ # Clean up the instance-variables set in the menu() interface next:
886
+ # ===================================================================== #
781
887
  reset_instance_variables_that_hold_all_arguments
782
- return @run_mode
888
+ return @internal_hash[:run_mode]
783
889
  end
784
890
  end; alias check_against_menu menu # === check_against_menu
785
891