universal_pipe_handler 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (123) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +461 -0
  3. data/doc/README.gen +417 -0
  4. data/doc/todo/todo_for_the_universal_pipe_handler_project.md +300 -0
  5. data/img/UNIVERSAL_PIPE_HANDLER_LOGO.jpg +0 -0
  6. data/img/pipe_paradise.png +0 -0
  7. data/lib/universal_pipe_handler/base/base.rb +147 -0
  8. data/lib/universal_pipe_handler/cmdlet/cmdlet.rb +287 -0
  9. data/lib/universal_pipe_handler/cmdlets/add.rb +15 -0
  10. data/lib/universal_pipe_handler/cmdlets/add_audio.rb +22 -0
  11. data/lib/universal_pipe_handler/cmdlets/all.rb +37 -0
  12. data/lib/universal_pipe_handler/cmdlets/any.rb +25 -0
  13. data/lib/universal_pipe_handler/cmdlets/ascii_video.rb +30 -0
  14. data/lib/universal_pipe_handler/cmdlets/assign.rb +24 -0
  15. data/lib/universal_pipe_handler/cmdlets/capture_screen.rb +46 -0
  16. data/lib/universal_pipe_handler/cmdlets/colourize.rb +35 -0
  17. data/lib/universal_pipe_handler/cmdlets/convert_to.rb +21 -0
  18. data/lib/universal_pipe_handler/cmdlets/convert_to_images.rb +17 -0
  19. data/lib/universal_pipe_handler/cmdlets/convert_to_mp3.rb +28 -0
  20. data/lib/universal_pipe_handler/cmdlets/convert_to_wav.rb +17 -0
  21. data/lib/universal_pipe_handler/cmdlets/copy_directories.rb +23 -0
  22. data/lib/universal_pipe_handler/cmdlets/count_character.rb +31 -0
  23. data/lib/universal_pipe_handler/cmdlets/count_longest_row.rb +21 -0
  24. data/lib/universal_pipe_handler/cmdlets/crop.rb +26 -0
  25. data/lib/universal_pipe_handler/cmdlets/cut.rb +101 -0
  26. data/lib/universal_pipe_handler/cmdlets/days.rb +41 -0
  27. data/lib/universal_pipe_handler/cmdlets/decolourize.rb +25 -0
  28. data/lib/universal_pipe_handler/cmdlets/download.rb +30 -0
  29. data/lib/universal_pipe_handler/cmdlets/download_torrent.rb +17 -0
  30. data/lib/universal_pipe_handler/cmdlets/duration.rb +34 -0
  31. data/lib/universal_pipe_handler/cmdlets/extract.rb +27 -0
  32. data/lib/universal_pipe_handler/cmdlets/extract_all.rb +23 -0
  33. data/lib/universal_pipe_handler/cmdlets/extract_audio.rb +30 -0
  34. data/lib/universal_pipe_handler/cmdlets/extract_video.rb +18 -0
  35. data/lib/universal_pipe_handler/cmdlets/find_all.rb +40 -0
  36. data/lib/universal_pipe_handler/cmdlets/generate_random_video.rb +29 -0
  37. data/lib/universal_pipe_handler/cmdlets/generate_string.rb +27 -0
  38. data/lib/universal_pipe_handler/cmdlets/get_all_audio_files.rb +33 -0
  39. data/lib/universal_pipe_handler/cmdlets/get_all_files.rb +61 -0
  40. data/lib/universal_pipe_handler/cmdlets/get_all_images.rb +47 -0
  41. data/lib/universal_pipe_handler/cmdlets/get_all_images_including_subdirs.rb +26 -0
  42. data/lib/universal_pipe_handler/cmdlets/get_all_video_files.rb +34 -0
  43. data/lib/universal_pipe_handler/cmdlets/get_last_characters.rb +24 -0
  44. data/lib/universal_pipe_handler/cmdlets/help.rb +36 -0
  45. data/lib/universal_pipe_handler/cmdlets/identify.rb +29 -0
  46. data/lib/universal_pipe_handler/cmdlets/increase_audio.rb +26 -0
  47. data/lib/universal_pipe_handler/cmdlets/install.rb +32 -0
  48. data/lib/universal_pipe_handler/cmdlets/match_regex.rb +24 -0
  49. data/lib/universal_pipe_handler/cmdlets/n_directories.rb +25 -0
  50. data/lib/universal_pipe_handler/cmdlets/n_files.rb +20 -0
  51. data/lib/universal_pipe_handler/cmdlets/n_words.rb +25 -0
  52. data/lib/universal_pipe_handler/cmdlets/number_lines.rb +34 -0
  53. data/lib/universal_pipe_handler/cmdlets/open_in_browser.rb +40 -0
  54. data/lib/universal_pipe_handler/cmdlets/pad_left.rb +20 -0
  55. data/lib/universal_pipe_handler/cmdlets/pad_right.rb +20 -0
  56. data/lib/universal_pipe_handler/cmdlets/play.rb +18 -0
  57. data/lib/universal_pipe_handler/cmdlets/position.rb +21 -0
  58. data/lib/universal_pipe_handler/cmdlets/processes.rb +18 -0
  59. data/lib/universal_pipe_handler/cmdlets/random.rb +21 -0
  60. data/lib/universal_pipe_handler/cmdlets/random_video.rb +23 -0
  61. data/lib/universal_pipe_handler/cmdlets/read_file.rb +44 -0
  62. data/lib/universal_pipe_handler/cmdlets/read_line.rb +31 -0
  63. data/lib/universal_pipe_handler/cmdlets/read_n_lines.rb +38 -0
  64. data/lib/universal_pipe_handler/cmdlets/read_n_lines_inverted.rb +36 -0
  65. data/lib/universal_pipe_handler/cmdlets/remove_audio.rb +22 -0
  66. data/lib/universal_pipe_handler/cmdlets/remove_comments.rb +26 -0
  67. data/lib/universal_pipe_handler/cmdlets/remove_directories.rb +29 -0
  68. data/lib/universal_pipe_handler/cmdlets/remove_html.rb +25 -0
  69. data/lib/universal_pipe_handler/cmdlets/remove_newlines.rb +23 -0
  70. data/lib/universal_pipe_handler/cmdlets/remove_numbers.rb +25 -0
  71. data/lib/universal_pipe_handler/cmdlets/repackage_to.rb +27 -0
  72. data/lib/universal_pipe_handler/cmdlets/replace_underscores.rb +29 -0
  73. data/lib/universal_pipe_handler/cmdlets/resize.rb +39 -0
  74. data/lib/universal_pipe_handler/cmdlets/resize_image.rb +45 -0
  75. data/lib/universal_pipe_handler/cmdlets/reverse.rb +22 -0
  76. data/lib/universal_pipe_handler/cmdlets/screenshot.rb +41 -0
  77. data/lib/universal_pipe_handler/cmdlets/search_torrent.rb +24 -0
  78. data/lib/universal_pipe_handler/cmdlets/seconds.rb +23 -0
  79. data/lib/universal_pipe_handler/cmdlets/select.rb +23 -0
  80. data/lib/universal_pipe_handler/cmdlets/show_lines.rb +31 -0
  81. data/lib/universal_pipe_handler/cmdlets/shuffle.rb +16 -0
  82. data/lib/universal_pipe_handler/cmdlets/shuffle_csv.rb +55 -0
  83. data/lib/universal_pipe_handler/cmdlets/size.rb +21 -0
  84. data/lib/universal_pipe_handler/cmdlets/sort_alphabetical.rb +20 -0
  85. data/lib/universal_pipe_handler/cmdlets/sort_by_date.rb +23 -0
  86. data/lib/universal_pipe_handler/cmdlets/starts_with.rb +25 -0
  87. data/lib/universal_pipe_handler/cmdlets/stat_file.rb +61 -0
  88. data/lib/universal_pipe_handler/cmdlets/to_ascii.rb +38 -0
  89. data/lib/universal_pipe_handler/cmdlets/to_camel_case.rb +38 -0
  90. data/lib/universal_pipe_handler/cmdlets/to_dna.rb +31 -0
  91. data/lib/universal_pipe_handler/cmdlets/to_movie.rb +16 -0
  92. data/lib/universal_pipe_handler/cmdlets/to_pdf.rb +58 -0
  93. data/lib/universal_pipe_handler/cmdlets/translate.rb +36 -0
  94. data/lib/universal_pipe_handler/cmdlets/upload_to.rb +29 -0
  95. data/lib/universal_pipe_handler/cmdlets/word_count.rb +39 -0
  96. data/lib/universal_pipe_handler/cmdlets/word_wrap.rb +26 -0
  97. data/lib/universal_pipe_handler/cmdlets/write_to.rb +51 -0
  98. data/lib/universal_pipe_handler/cmdlets/years.rb +30 -0
  99. data/lib/universal_pipe_handler/cmdlets_handler/cmdlets_handler.rb +193 -0
  100. data/lib/universal_pipe_handler/colours/colourize.rb +112 -0
  101. data/lib/universal_pipe_handler/colours/colours.rb +54 -0
  102. data/lib/universal_pipe_handler/configuration/configuration.rb +18 -0
  103. data/lib/universal_pipe_handler/constants/constants.rb +201 -0
  104. data/lib/universal_pipe_handler/dataset/dataset.rb +14 -0
  105. data/lib/universal_pipe_handler/project/project.rb +36 -0
  106. data/lib/universal_pipe_handler/requires/do_require_the_individual_cmdlet_files.rb +21 -0
  107. data/lib/universal_pipe_handler/requires/require_the_universal_pipe_handler.rb +14 -0
  108. data/lib/universal_pipe_handler/shell/shell.rb +256 -0
  109. data/lib/universal_pipe_handler/toplevel_methods/all_actions.rb +48 -0
  110. data/lib/universal_pipe_handler/toplevel_methods/cmdlet_directory.rb +22 -0
  111. data/lib/universal_pipe_handler/toplevel_methods/e.rb +16 -0
  112. data/lib/universal_pipe_handler/toplevel_methods/misc.rb +54 -0
  113. data/lib/universal_pipe_handler/toplevel_methods/rds.rb +18 -0
  114. data/lib/universal_pipe_handler/toplevel_methods/token.rb +18 -0
  115. data/lib/universal_pipe_handler/version/version.rb +19 -0
  116. data/lib/universal_pipe_handler/yaml/aliases_to_cmdlets.yml +250 -0
  117. data/lib/universal_pipe_handler/yaml/allowed_cmdlets.yml +118 -0
  118. data/lib/universal_pipe_handler/yaml/predefined_methods.yml +15 -0
  119. data/lib/universal_pipe_handler.rb +5 -0
  120. data/test/testing_the_universal_pipe_handler.rb +65 -0
  121. data/test/this_file +46 -0
  122. data/universal_pipe_handler.gemspec +80 -0
  123. metadata +299 -0
data/doc/README.gen ADDED
@@ -0,0 +1,417 @@
1
+ ADD_DEFAULT_HEADER
2
+ ADD_GOBOLINUX_LINK
3
+
4
+ # The Universal Pipe Handler Project
5
+
6
+ Handling Pipes - via Ruby
7
+
8
+ <i>„Because one pipe can rule them all ...“</i>
9
+
10
+ <img src="https://i.imgur.com/c7lFded.jpg" style="margin: 1em">
11
+
12
+ ## Description
13
+
14
+ This project aims to implement pipes, in ruby. The idea here is to be able
15
+ to use a fully OOP-centric implementation of pipes, rather than "merely"
16
+ a simulation of UNIX/Linux pipes as such. Thus, the project attempts to
17
+ include ideas from other projects, such as the powershell on Windows.
18
+ It also attempts to include ideas gained from projects such
19
+ as Avisynth/VirtualDub, which was a really useful project when it
20
+ came to <b>applying filters</b> to image, video and audio files.
21
+
22
+ The actual implementation of the project may be split up into separate
23
+ projects, but will be unified within the Universal Pipe Handler (UPH).
24
+
25
+ The general input-output follows this simple schematic:
26
+
27
+ <img src="https://i.imgur.com/Mp9y6ZY.png" style="margin: 1em">
28
+
29
+ ## How to require the project
30
+
31
+ Use this to require the project:
32
+
33
+ require 'universal_pipe_handler'
34
+
35
+ ## Usage examples
36
+
37
+ This subsection will try to show various usage examples that should be
38
+ guaranteed to work, provided that you have installed various other
39
+ projects (gems). For instance, for multimedia-related actions you
40
+ will require the gem called <b>multimedia_paradise</b>.
41
+
42
+ Extract audio from a .mp4 file:
43
+
44
+ foobar.mp4 | extract_audio
45
+ foobar.mp4 | extract audio # both variants must work
46
+
47
+ Extract audio from a .mp4 file and convert it into a .wav file:
48
+
49
+ foobar.mp4 | extract audio | convert into .wav file
50
+ foobar.mp4 | extract audio | convert_into_wav_file
51
+ foobar.mp4 | extract audio | to_wav
52
+ foobar.mp4 | extract audio | towav
53
+ foobar.mp4 | extract audio | 2wav
54
+ foobar.mp4 | extract_audio | 2wav
55
+
56
+ Camelcase all files in the current working directory:
57
+
58
+ ls | camel_case
59
+ ls | camel case
60
+ ls | camelCase
61
+ ls | camel
62
+
63
+ ## The unimportant history of this project
64
+
65
+ I initially started this project back in <b>2007</b> or so, under another name -
66
+ the Hermes pipe. The idea here was that Hermes, from the Greek mythology,
67
+ would deliver messages to others. In German the name is "Götterbote".
68
+
69
+ After the Hermes pipe I created the Solar pipe, then the Master Pipe,
70
+ then PipeHandler and eventually renamed the project to
71
+ **PipeParadise**. Then it was idle for about 5 years or so, until
72
+ <b>June 2022</b>. Quite a lot of history here, eh?
73
+
74
+ Most of my more successful projects end up with the string
75
+ *paradise*, such as **ftp_paradise** and so forth.
76
+
77
+ I will most likely stick to the name <b>universal pipe handler</b>,
78
+ but who knows really. I thought I'd stick with **PipeParadise** as
79
+ a name as well, largely because many of my other ruby-based
80
+ projects have the suffix *paradise*, but then I changed my
81
+ mind again. So who knows.
82
+
83
+ Why so many rewrites, aside from the various name changes, though?
84
+
85
+ The Hermes pipe ended up being way too hard to maintain, so I
86
+ thought about *simplifying** it and using a better, simpler concept,
87
+ including a full specification of the behaviour. This part is
88
+ very important: I wanted to **document what is available**, so
89
+ that if I need to rewrite anything in the future again, one day, I
90
+ can just refer to that specification and continue from there.
91
+
92
+ Thus, this is one goal of the universal pipe handler: to really
93
+ specify what it can do, at all times.
94
+
95
+ ## Current status of the Universal Pipe Handler project
96
+
97
+ The current status of the Universal Pipe Handler project is not
98
+ complete at all, but it is still better than the prior status
99
+ quo, which had no specification at all whatsoever.
100
+
101
+ ## Definition and Specification for the Universal Pipe Handler
102
+
103
+ This subsection will contain some definitions and specifications
104
+ for the universal pipe handler project.
105
+
106
+ The definition of a **cmdlet**, short for <b>Commandlet</b>. An
107
+ alternative name for a <b>cmdlet</b> would be a <b>command
108
+ snippet</b>.
109
+
110
+ A **cmdlet**, as far as the universal pipe handler project is
111
+ concerned, is everything before and after a pipe token
112
+ (the <b>|</b> token). The pipe must be able to interprete
113
+ these cmdlets.
114
+
115
+ If you look at the above example again:
116
+
117
+ foobar.mp4 | extract_audio | to_wav
118
+
119
+ Then you can see two | pipe tokens, and a total of three
120
+ individual **cmdlets**.
121
+
122
+ Let's look at another example:
123
+
124
+ ls | nl | remove comments from mp3 files
125
+
126
+ This would list all entries from the correct working directory,
127
+ number them (from 1 to n), then remove all comments from mp3
128
+ files found, and finally display the result to the user.
129
+
130
+ Thus, in this case you have three individual <b>cmdlets</b>:
131
+
132
+ ls
133
+ nl
134
+ remove comments from mp3 files
135
+
136
+ So everything before and after any individual '|' token
137
+ is an individual "cmdlet". The primary objective for
138
+ the universal pipe handler is to interprete and evaluate
139
+ the cmdlet correctly.
140
+
141
+ We also have to store data that has to be exchanged between
142
+ the individual command-snippets. This data will be
143
+ stored in a toplevel variable called @dataset.
144
+
145
+ If there is an unknown instruction given, that is, an unknown
146
+ cmdlet, then this must be reported to the user. Then the pipe
147
+ will either exit (and thus terminate) or continue nonetheless,
148
+ depending on the behaviour used for this pipe instruction.
149
+
150
+ ## Individual cmdlets described
151
+
152
+ This subsection will describe individual cmdlets. Ideally
153
+ **every** cmdlet should be described, so that we can
154
+ evaluate the behaviour and check it against the main
155
+ specification.
156
+
157
+ Note that each individual cmdlet **must** be registered
158
+ in the Array that is stored in the file called
159
+ <b>allowed_cmdlets.yml</b>.
160
+
161
+ Keep the following list sorted alphabetically.
162
+
163
+ <b>add_audio</b>: This cmdlet attempts to add an audio to a
164
+ video file. It also supports shortcuts via **BeautifulUrl**.
165
+
166
+ <b>all</b>: This is a general wrapper towards doing an action on "all"
167
+ files or directories. It allows you to pattern-match towards a
168
+ specific pattern. For instance, if you do "all rb files" then
169
+ we will fetch all .rb files of a given directory.
170
+
171
+ <b>all_images_from</b>: this cmdlet will obtain all images from
172
+ a subdirectory. It also responds to :symbols, such as in the
173
+ following example: <b>all_images_from :njoy_dir</b>. The symbols
174
+ specify from where something should be read.
175
+
176
+ <b>any</b>: This is a commandlet for convenience. For instance, if you
177
+ do "any avi" then we will fetch any avi file (randomly). This can be
178
+ used in pipes like: "any mp3 | stat" to report the size of that
179
+ file. Not too terribly useful, unless you want to quickly test
180
+ something.
181
+
182
+ <b>ascii_video</b>: This commandlet allows the user to play a video,
183
+ in mplayer, as ASCII Art, using the <b>aalib library</b>.
184
+
185
+ <b>assign</b>: this cmdlet allows the user to assign to
186
+ a specific file. Is the default for the first pipe
187
+ processing task, to allow the user to operate with
188
+ existing local files.
189
+
190
+ <b>copy_directories</b>: will copy all directories found within
191
+ a directory into another target.
192
+
193
+ <b>colourize</b>: This little cmdlet allows the user to colourize
194
+ string input in any way they see fit. Right now it is a bit
195
+ limited though, you have to extend it as you use that.
196
+
197
+ <b>crop</b>: Crop can be used to crop (make it smaller) any
198
+ given image or a video, such as from 1024px to 800px.
199
+
200
+ <b>cut</b>: cut audio ... like cut 30%. This would take from the beginning at
201
+ 0% up to 30% of the audio file. We start from the left side by default, which
202
+ is where audio and video files are normally started. If you provide a
203
+ negative number here, like -30%, then we instead count from 100% to the
204
+ left, in other words, -30% would mean 70% up to 100%. To recapitulate, if
205
+ you use -30%, we start from the right side instead. (This allows you to
206
+ clip away only the last part of an audio file.)
207
+
208
+ Here are two examples to highlight this:
209
+ assign foo.mp3 | cut -30%
210
+ ^^^ cut away the last 30% of the audio file.
211
+ assign foo.mp3 | cut -30
212
+ ^^^ cut away the last 30 seconds of the audio file.
213
+
214
+ Note though that the general action "cut" could also mean to "cut this
215
+ video file", so since December 2011 we assume that cutting a video file
216
+ means that we want to just cut away some parts of it.
217
+
218
+ You can also use percentages, such as "30%-80%". This will start
219
+ cutting at 30% and proceed up to 80% of the file length.
220
+
221
+ <b>decolourize</b>: this cmdlet get rid of colours from a
222
+ <b>video</b> file specifically.
223
+
224
+ <b>download</b>: Like wget, this allows the user to download
225
+ something. This uses a pure ruby solution, so the user
226
+ is independent of <b>wget</b> actually.
227
+
228
+ <b>extract</b>: this is a meta instruction. Applied on video
229
+ data, it will try to extract the audio and the video
230
+ separately. Applied to an archive, such as a .zip file,
231
+ it will extract said archive.
232
+
233
+ <b>extract_all</b>: this cmdlet allows the user to
234
+ extract all packages in a given location.
235
+
236
+ <b>find_all</b>: this cmdlet allows the user to find a
237
+ substring. <b>Grep</b> is an alias to this, so this is
238
+ mostly a simulation of <b>grep</b>.
239
+
240
+ <b>generate_string</b>: this cmdlet allows us to generate a string,
241
+ in particular a random string.
242
+
243
+ <b>get_all_files</b>: This commandlet will obtain all files
244
+ of a given directory. It should equal the UNIX command
245
+ "ls", more or less.
246
+
247
+ <b>get_last_characters</b>: How many characters we can get from a
248
+ string or a file.
249
+
250
+ <b>help?</b>: lists all available commands that are supported
251
+ by the <b>universal pipe handler</b>.
252
+
253
+ <b>identify</b>: This cmdlet can be used to identify a
254
+ multimedia component, be it audio or video related data.
255
+
256
+ <b>install</b>: We try to install something with this cmdlet.
257
+ This can be used like in "install | htop" to install htop.
258
+ The latter will make use of the <b>rbt</b> project.
259
+
260
+ <b>match_regex</b>: This cmdlet allows the user to match to
261
+ regexes found in a given file.
262
+
263
+ <b>n_words</b>: report how many words are in a given file, or
264
+ somewhere else.
265
+
266
+ <b>play</b>: use this cmdlet to play an audio or a video
267
+ file. Some aliases exist to this, i.e. <b>play_video_file</b>.
268
+
269
+ <b>random line</b>: fetch a random line from a file. This
270
+ is usually done to show (display) that line.
271
+
272
+ <b>read_file</b>: This cmdlet will read the content of a file, similar
273
+ to the unix "cat" command. If you use a <b>:</b> then we will use
274
+ BeautifyUrl here. This allows us to access registered files more
275
+ readily using symbols as shortcuts. Specific example for this
276
+ functionality: <b>read_file :pc</b>
277
+
278
+ <b>read_line</b>: Read a specific line in a file. Like "read_line 9"
279
+ allows you to read the ninth line. (Show line number x). Note that
280
+ the keyword "last" will fetch the last line of a file.
281
+
282
+ <b>remove_audio</b>: This action attempts to remove the audio found
283
+ in a video container or somewhere else. It will then create a new
284
+ file, for instance called output.avi
285
+
286
+ <b>remove_comments</b>: this commandlet will remove comments from a
287
+ file. The default comment specifier is the '#' character. Anything
288
+ after that token will be removed, including that token itself.
289
+
290
+ <b>remove_directories</b>: removes all directories. Use with
291
+ care. Note that <b>/</b> will never be assumed to be a
292
+ valid directory for removal via this functionality.
293
+
294
+ <b>remove_html</b>: This cmdlet will remove all <html> tags found
295
+ in a given String. It can be used to "sanitize" a downloaded
296
+ .html page, for instance, if the user needs the raw text.
297
+
298
+ <b>remove_newlines</b>: This cmdlet will simply remove newlines.
299
+ In pure ruby code, this would be equal to .delete("\n").
300
+ <b>strip_newlines</b> is an alias to this cmdlet.
301
+
302
+ <b>repackage_to</b>: allows us to fill in the @result into a
303
+ method and repackage that. A typical example for this may be
304
+ <b>repackage_to .tar.xz</b>.
305
+
306
+ <b>resize_image</b>: This cmdlet allows the user to resize a given
307
+ image. Right now, resize is an alias to resize_image but in the
308
+ future we may wish to use resize on videos as well.
309
+
310
+ <b>search</b>: the search-cmdlet is primarily used to search
311
+ for torrents that can be downloaded, since as of June 2011.
312
+ However had, it may be extended eventually towards a more
313
+ comprehensible search-functionality.
314
+
315
+ <b>shuffle_csv</b>: This commandlet can be used to shuffle CSV
316
+ values. shuffle_csv 1,5,6 means that the entries at 5 and 6 will
317
+ become right next to 1. It thus reoganizes the entries in a
318
+ csv file.
319
+
320
+ Specific Example:
321
+
322
+ assign /Depot/j/test.csv | shuffle_csv 1,5,6 | save_as /Depot/j/output.csv
323
+
324
+ <b>starts_with?</b>: This queries whether a line starts with
325
+ a specific substring or not. If yes, then we add it.
326
+
327
+ <b>this_dir</b>: This is not a commandlet-action as such,
328
+ but a special alias. It is expanded into "assign Dir.pwd"
329
+ for the most part (or, more accurately, into the method
330
+ return_pwd, which is more or less equal to Dir.pwd, but
331
+ with a trailing <b>/</b>).
332
+
333
+ <b>to_camel_case</b>: This will camelCase the given input.
334
+ If a list of files is passed then this will be applied
335
+ onto each file. Thus, use with caution.
336
+
337
+ <b>to_pdf</b>: This cmdlet can be used to create a .pdf
338
+ file.
339
+
340
+ <b>word_count</b>: This will simply count the word frequency of a
341
+ file or all files in a given directory. In case a directory is
342
+ provided here, the current behaviour is to find all files in
343
+ that given directory and count the words found therein, in all
344
+ of these files.
345
+
346
+ <b>word_wrap</b>: wraps words after <n characters>. word_wrap
347
+ 76 would wrap after 76 characters. Aliases like wrap at
348
+ exist, with wrap at 30 wrapping at every 30th character.
349
+
350
+ ## How to use several cmdlets
351
+
352
+ You can combine these cmdlets like in the following manner:
353
+
354
+ handler = UniversalPipeHandler.new 'assign foo.avi | filter huffyman | save to /Depot/bla.avi'
355
+
356
+ This will run the passed cmdlets - first assign to foo.avi, then run
357
+ through a <b>huffyman filter</b>, and then save the result of
358
+ that into a new file. The whole line is called a <b>pipe</b>.
359
+
360
+ Rather than UniversalPipeHandler.new() you could also use the slightly
361
+ shorter UniversalPipeHandler[] method call.
362
+
363
+ ## class UniversalPipeHandler::CmdletsHandler
364
+
365
+ This class will handle individual cmdlets. Individual cmdlets
366
+ will, in turn, be handled by <b>class UniversalPipeHandler::Cmdlet</b>,
367
+ so <b>class UniversalPipeHandler::CmdletsHandler</b> is the kind of
368
+ cmdlet-"controller".
369
+
370
+ ## Readline support
371
+
372
+ The universal_pipe_handler should be able to make use of Readline,
373
+ in particular upon completion of all registered cmdlets. This
374
+ should also work with aliases towards cmdlets.
375
+
376
+ Readline can be used for <b>tab completion</b>. The current
377
+ behaviour is to tab-complete on every available cmdlet
378
+ snippet, including the aliases to it. This should allow the
379
+ user to complete individual instructions towards a cmdlet.
380
+
381
+ ## The variable @result
382
+
383
+ Data that is processed between two different cmdlets is always
384
+ stored in the toplevel instance variable @result. Access to
385
+ this toplevel instance variable should occur via the method
386
+ <b>.result?</b>.
387
+
388
+ ## Compatibility to Avisynth
389
+
390
+ Avisynth was a really interesting program that would allow the
391
+ user to do various video-related manipulations in a pipe-oriented
392
+ manner. You could do numerous things with it, including overlaying
393
+ commercial ads on a TV show with some ad-hoc bar that would
394
+ censor it away, programmatically. This focus on using avisynth
395
+ like a **script** was what really was nifty. I am trying to
396
+ add support for this into the **universal pipe handler**
397
+ from the get go, via ffmpeg, but who knows how far I'll get
398
+ with this.
399
+
400
+ The following subsection shall show some examples how avisynth
401
+ could be used:
402
+
403
+ # Add a subtitle
404
+ AviSource("foobar.avi")
405
+ Subtitle("Hello World!", size=56, align=5)
406
+
407
+ # Flip the video vertically
408
+ DirectShowSource('foobar.avi')
409
+ FlipVertical
410
+
411
+ # resize the dimensions of the video frame to 320x240
412
+ LanczosResize(320, 240)
413
+
414
+ # fade-in the first 15 frames from black
415
+ FadeIn(15)
416
+
417
+ ADD_CONTACT_INFORMATION