ftp_paradise 1.4.5 → 1.5.4

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