freespeech 1.0.82 → 1.0.88
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/CYCLE_OF_HEALTH +9 -15
 - data/Makefile +1 -1
 - data/README.md +54 -46
 - data/VERSION_NUMBER +1 -1
 - data/bin/append_each +0 -0
 - data/bin/google_speak +4 -3
 - data/bin/lines +0 -0
 - data/bin/nth_word +0 -0
 - data/bin/prepend_each +0 -0
 - data/bin/rgsub +0 -0
 - data/documentation/append_each +3 -0
 - data/documentation/left_right.exe +1 -1
 - data/documentation/page +41 -41
 - data/documentation/prepend_each +3 -0
 - data/gem_data/VERSION_NUMBER +1 -1
 - data/index.html +57 -51
 - data/install.sh +5 -1
 - data/non_compiled_programs/google_speak +4 -3
 - data/src/_compilation/abs +38 -19
 - data/src/_compilation/add +38 -19
 - data/src/_compilation/append +38 -19
 - data/src/_compilation/append_each +290 -0
 - data/src/_compilation/args +38 -19
 - data/src/_compilation/delete +38 -19
 - data/src/_compilation/div +38 -19
 - data/src/_compilation/exp +38 -19
 - data/src/_compilation/floor +38 -19
 - data/src/_compilation/gsub +38 -19
 - data/src/_compilation/gsubip +38 -19
 - data/src/_compilation/last_nth +38 -19
 - data/src/_compilation/lines +38 -19
 - data/src/_compilation/mul +38 -19
 - data/src/_compilation/nth +38 -19
 - data/src/_compilation/nth_word +38 -19
 - data/src/_compilation/prepend +38 -19
 - data/src/_compilation/prepend_each +290 -0
 - data/src/_compilation/rip +38 -19
 - data/src/_compilation/rnip +38 -19
 - data/src/_compilation/selectlines +38 -19
 - data/src/_compilation/sub +38 -19
 - data/src/_compilation/swap +38 -19
 - data/src/_compilation/trim +38 -19
 - data/src/programs/append_each +0 -0
 - data/src/programs/lines +0 -0
 - data/src/programs/prepend_each +0 -0
 - data/src/rgsub +0 -0
 - data/src/rgsub.c +24 -25
 - data/src/src/Makefile +1 -1
 - data/src/src/cd +3 -0
 - data/src/src/code +30 -9
 - data/src/src/functions.cr +29 -16
 - data/src/src/mk +6 -8
 - data/src/src/rm +1 -0
 - metadata +12 -3
 - data/src/src/q.cr +0 -9
 - /data/images/{12.png → 8.png} +0 -0
 
    
        data/install.sh
    CHANGED
    
    | 
         @@ -16,7 +16,11 @@ else 
     | 
|
| 
       16 
16 
     | 
    
         
             
              clobber=
         
     | 
| 
       17 
17 
     | 
    
         
             
            fi
         
     | 
| 
       18 
18 
     | 
    
         | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
      
 19 
     | 
    
         
            +
            if [[ "$1" =~ "y" ]]; then
         
     | 
| 
      
 20 
     | 
    
         
            +
            	var=
         
     | 
| 
      
 21 
     | 
    
         
            +
            else
         
     | 
| 
      
 22 
     | 
    
         
            +
            	read -p "Enter path besides /usr/bin to install (or leave blank) " var
         
     | 
| 
      
 23 
     | 
    
         
            +
            fi
         
     | 
| 
       20 
24 
     | 
    
         | 
| 
       21 
25 
     | 
    
         
             
            test -z || mkdir -p "$var"
         
     | 
| 
       22 
26 
     | 
    
         | 
| 
         @@ -1,3 +1,4 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            #!/bin/ 
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
      
 1 
     | 
    
         
            +
            #!/bin/sh
         
     | 
| 
      
 2 
     | 
    
         
            +
            IFS=+
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            mplayer -ao alsa -really-quiet -noconsolecontrols "http://translate.google.com/translate_tts?ie=UTF-8&client=tw-ob&q=$*&tl=en" 2>/dev/null 1>/dev/null
         
     | 
    
        data/src/_compilation/abs
    CHANGED
    
    | 
         @@ -1,11 +1,24 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            #!/usr/bin/crystal
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
      
 3 
     | 
    
         
            +
            CORE_UTIL_STRING = "core_utils"
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            def prepend_each(arg)
         
     | 
| 
      
 6 
     | 
    
         
            +
              STDIN.each_line do |line|
         
     | 
| 
      
 7 
     | 
    
         
            +
                puts arg + line
         
     | 
| 
      
 8 
     | 
    
         
            +
              end
         
     | 
| 
       7 
9 
     | 
    
         
             
            end
         
     | 
| 
       8 
10 
     | 
    
         | 
| 
      
 11 
     | 
    
         
            +
            def append_each(arg)
         
     | 
| 
      
 12 
     | 
    
         
            +
              STDIN.each_line do |line|
         
     | 
| 
      
 13 
     | 
    
         
            +
                puts line + arg
         
     | 
| 
      
 14 
     | 
    
         
            +
              end
         
     | 
| 
      
 15 
     | 
    
         
            +
            end
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
            def delete(arg)
         
     | 
| 
      
 18 
     | 
    
         
            +
              `find -name #{arg}`.each_line do |i|
         
     | 
| 
      
 19 
     | 
    
         
            +
                File.delete(i)
         
     | 
| 
      
 20 
     | 
    
         
            +
              end
         
     | 
| 
      
 21 
     | 
    
         
            +
            end
         
     | 
| 
       9 
22 
     | 
    
         | 
| 
       10 
23 
     | 
    
         
             
            def nth_word(arg)
         
     | 
| 
       11 
24 
     | 
    
         
             
              i = arg.to_u64 - 1
         
     | 
| 
         @@ -20,11 +33,11 @@ def trim() 
     | 
|
| 
       20 
33 
     | 
    
         
             
              end
         
     | 
| 
       21 
34 
     | 
    
         
             
            end
         
     | 
| 
       22 
35 
     | 
    
         | 
| 
       23 
     | 
    
         
            -
            def lines()
         
     | 
| 
      
 36 
     | 
    
         
            +
            def lines(folder = ".")
         
     | 
| 
       24 
37 
     | 
    
         
             
              if !STDIN.tty?
         
     | 
| 
       25 
     | 
    
         
            -
                puts STDIN.gets_to_end.count( 
     | 
| 
      
 38 
     | 
    
         
            +
                puts STDIN.gets_to_end.count('\n')
         
     | 
| 
       26 
39 
     | 
    
         
             
              else
         
     | 
| 
       27 
     | 
    
         
            -
                res = `find  
     | 
| 
      
 40 
     | 
    
         
            +
                res = `find #{folder}`.count('\n') - 1
         
     | 
| 
       28 
41 
     | 
    
         
             
                puts res
         
     | 
| 
       29 
42 
     | 
    
         
             
              end
         
     | 
| 
       30 
43 
     | 
    
         
             
            end
         
     | 
| 
         @@ -155,25 +168,25 @@ end 
     | 
|
| 
       155 
168 
     | 
    
         
             
            def gsubip(arg1, arg2, arg3)
         
     | 
| 
       156 
169 
     | 
    
         
             
              regex = Regex.new(arg1)
         
     | 
| 
       157 
170 
     | 
    
         
             
              text = File.read(arg3).gsub(/#{arg1}/m, arg2)
         
     | 
| 
       158 
     | 
    
         
            -
              File.open(t = File.tempname( 
     | 
| 
      
 171 
     | 
    
         
            +
              File.open(t = File.tempname(CORE_UTIL_STRING, "_tmp"), "w", File.info(arg3).permissions) do |h|
         
     | 
| 
       159 
172 
     | 
    
         
             
                h.print text
         
     | 
| 
       160 
173 
     | 
    
         
             
              end
         
     | 
| 
       161 
174 
     | 
    
         
             
              begin
         
     | 
| 
       162 
175 
     | 
    
         
             
                File.rename t, arg3
         
     | 
| 
       163 
176 
     | 
    
         
             
              rescue
         
     | 
| 
       164 
     | 
    
         
            -
                 
     | 
| 
      
 177 
     | 
    
         
            +
                File.delete t
         
     | 
| 
       165 
178 
     | 
    
         
             
              end
         
     | 
| 
       166 
179 
     | 
    
         
             
            end
         
     | 
| 
       167 
180 
     | 
    
         | 
| 
       168 
181 
     | 
    
         
             
            def rip(arg1, arg2, arg3)
         
     | 
| 
       169 
182 
     | 
    
         
             
              text = File.read(arg3).gsub(arg1, arg2)
         
     | 
| 
       170 
     | 
    
         
            -
              File.open(t = File.tempname( 
     | 
| 
      
 183 
     | 
    
         
            +
              File.open(t = File.tempname(CORE_UTIL_STRING, "_tmp"), "w", File.info(arg3).permissions) do |h|
         
     | 
| 
       171 
184 
     | 
    
         
             
                h.print text
         
     | 
| 
       172 
185 
     | 
    
         
             
              end
         
     | 
| 
       173 
186 
     | 
    
         
             
              begin
         
     | 
| 
       174 
187 
     | 
    
         
             
                File.rename t, arg3
         
     | 
| 
       175 
188 
     | 
    
         
             
              rescue
         
     | 
| 
       176 
     | 
    
         
            -
                 
     | 
| 
      
 189 
     | 
    
         
            +
                File.delete t
         
     | 
| 
       177 
190 
     | 
    
         
             
              end
         
     | 
| 
       178 
191 
     | 
    
         
             
            end
         
     | 
| 
       179 
192 
     | 
    
         | 
| 
         @@ -197,7 +210,7 @@ def swap(file1, file2) 
     | 
|
| 
       197 
210 
     | 
    
         
             
              [file1, file2].each do |f|
         
     | 
| 
       198 
211 
     | 
    
         
             
                File.exists?(f) || abort("No file named #{f.dump}")
         
     | 
| 
       199 
212 
     | 
    
         
             
              end
         
     | 
| 
       200 
     | 
    
         
            -
              t = File.tempname( 
     | 
| 
      
 213 
     | 
    
         
            +
              t = File.tempname(CORE_UTIL_STRING, "_tmp")
         
     | 
| 
       201 
214 
     | 
    
         | 
| 
       202 
215 
     | 
    
         
             
              File.rename file1, t
         
     | 
| 
       203 
216 
     | 
    
         
             
              File.rename file2, file1
         
     | 
| 
         @@ -207,27 +220,27 @@ end 
     | 
|
| 
       207 
220 
     | 
    
         
             
            def prepend(file)
         
     | 
| 
       208 
221 
     | 
    
         
             
              file_data = File.read(file)
         
     | 
| 
       209 
222 
     | 
    
         
             
              new_data = STDIN.gets_to_end
         
     | 
| 
       210 
     | 
    
         
            -
              File.open(t = File.tempname( 
     | 
| 
      
 223 
     | 
    
         
            +
              File.open(t = File.tempname(CORE_UTIL_STRING, "_tmp"), "w", File.info(file).permissions) do |h|
         
     | 
| 
       211 
224 
     | 
    
         
             
                h << new_data + file_data
         
     | 
| 
       212 
225 
     | 
    
         
             
              end
         
     | 
| 
       213 
226 
     | 
    
         | 
| 
       214 
227 
     | 
    
         
             
              begin
         
     | 
| 
       215 
228 
     | 
    
         
             
                File.rename t, file
         
     | 
| 
       216 
229 
     | 
    
         
             
              rescue
         
     | 
| 
       217 
     | 
    
         
            -
                 
     | 
| 
      
 230 
     | 
    
         
            +
                File.delete t
         
     | 
| 
       218 
231 
     | 
    
         
             
              end
         
     | 
| 
       219 
232 
     | 
    
         
             
            end
         
     | 
| 
       220 
233 
     | 
    
         | 
| 
       221 
234 
     | 
    
         
             
            def append(file)
         
     | 
| 
       222 
235 
     | 
    
         
             
              file_data = File.read(file)
         
     | 
| 
       223 
236 
     | 
    
         
             
              new_data = STDIN.gets_to_end
         
     | 
| 
       224 
     | 
    
         
            -
              File.open(t = File.tempname( 
     | 
| 
      
 237 
     | 
    
         
            +
              File.open(t = File.tempname(CORE_UTIL_STRING, "_tmp"), "w", File.info(file).permissions) do |h|
         
     | 
| 
       225 
238 
     | 
    
         
             
                h << file_data + new_data
         
     | 
| 
       226 
239 
     | 
    
         
             
              end
         
     | 
| 
       227 
240 
     | 
    
         
             
              begin
         
     | 
| 
       228 
241 
     | 
    
         
             
                File.rename t, file
         
     | 
| 
       229 
242 
     | 
    
         
             
              rescue
         
     | 
| 
       230 
     | 
    
         
            -
                 
     | 
| 
      
 243 
     | 
    
         
            +
                File.delete t
         
     | 
| 
       231 
244 
     | 
    
         
             
              end
         
     | 
| 
       232 
245 
     | 
    
         
             
            end
         
     | 
| 
       233 
246 
     | 
    
         | 
| 
         @@ -258,13 +271,19 @@ class Funcs 
     | 
|
| 
       258 
271 
     | 
    
         
             
            end
         
     | 
| 
       259 
272 
     | 
    
         | 
| 
       260 
273 
     | 
    
         | 
| 
       261 
     | 
    
         
            -
            def main 
     | 
| 
       262 
     | 
    
         
            -
               
     | 
| 
      
 274 
     | 
    
         
            +
            def main
         
     | 
| 
      
 275 
     | 
    
         
            +
              size = ARGV.size
         
     | 
| 
      
 276 
     | 
    
         
            +
              
         
     | 
| 
      
 277 
     | 
    
         
            +
              if size > 0
         
     | 
| 
       263 
278 
     | 
    
         
             
                Funcs.argument_data("abs", "[abs] [arguments]", "Abs gets the absolute value of an integer\n\nThe absolute value of a number is the value of that number without its sign\n\necho -300 | abs\n\n=> 300\n\necho 200 | abs\n\n=> 200 \n\n(echo -2; echo -10) | sub | abs\n\n=> 12\n\nThe last one would do -2 - -10, the result would be -12, and then the absolute value would be computed, and so the result would be 12.")
         
     | 
| 
       264 
279 
     | 
    
         
             
                exit 1
         
     | 
| 
       265 
280 
     | 
    
         
             
              end
         
     | 
| 
       266 
281 
     | 
    
         | 
| 
       267 
     | 
    
         
            -
               
     | 
| 
      
 282 
     | 
    
         
            +
              begin
         
     | 
| 
      
 283 
     | 
    
         
            +
              	abs
         
     | 
| 
      
 284 
     | 
    
         
            +
              rescue e : Exception
         
     | 
| 
      
 285 
     | 
    
         
            +
              	puts e
         
     | 
| 
      
 286 
     | 
    
         
            +
              end
         
     | 
| 
       268 
287 
     | 
    
         
             
            end
         
     | 
| 
       269 
288 
     | 
    
         | 
| 
       270 
289 
     | 
    
         | 
    
        data/src/_compilation/add
    CHANGED
    
    | 
         @@ -1,11 +1,24 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            #!/usr/bin/crystal
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
      
 3 
     | 
    
         
            +
            CORE_UTIL_STRING = "core_utils"
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            def prepend_each(arg)
         
     | 
| 
      
 6 
     | 
    
         
            +
              STDIN.each_line do |line|
         
     | 
| 
      
 7 
     | 
    
         
            +
                puts arg + line
         
     | 
| 
      
 8 
     | 
    
         
            +
              end
         
     | 
| 
       7 
9 
     | 
    
         
             
            end
         
     | 
| 
       8 
10 
     | 
    
         | 
| 
      
 11 
     | 
    
         
            +
            def append_each(arg)
         
     | 
| 
      
 12 
     | 
    
         
            +
              STDIN.each_line do |line|
         
     | 
| 
      
 13 
     | 
    
         
            +
                puts line + arg
         
     | 
| 
      
 14 
     | 
    
         
            +
              end
         
     | 
| 
      
 15 
     | 
    
         
            +
            end
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
            def delete(arg)
         
     | 
| 
      
 18 
     | 
    
         
            +
              `find -name #{arg}`.each_line do |i|
         
     | 
| 
      
 19 
     | 
    
         
            +
                File.delete(i)
         
     | 
| 
      
 20 
     | 
    
         
            +
              end
         
     | 
| 
      
 21 
     | 
    
         
            +
            end
         
     | 
| 
       9 
22 
     | 
    
         | 
| 
       10 
23 
     | 
    
         
             
            def nth_word(arg)
         
     | 
| 
       11 
24 
     | 
    
         
             
              i = arg.to_u64 - 1
         
     | 
| 
         @@ -20,11 +33,11 @@ def trim() 
     | 
|
| 
       20 
33 
     | 
    
         
             
              end
         
     | 
| 
       21 
34 
     | 
    
         
             
            end
         
     | 
| 
       22 
35 
     | 
    
         | 
| 
       23 
     | 
    
         
            -
            def lines()
         
     | 
| 
      
 36 
     | 
    
         
            +
            def lines(folder = ".")
         
     | 
| 
       24 
37 
     | 
    
         
             
              if !STDIN.tty?
         
     | 
| 
       25 
     | 
    
         
            -
                puts STDIN.gets_to_end.count( 
     | 
| 
      
 38 
     | 
    
         
            +
                puts STDIN.gets_to_end.count('\n')
         
     | 
| 
       26 
39 
     | 
    
         
             
              else
         
     | 
| 
       27 
     | 
    
         
            -
                res = `find  
     | 
| 
      
 40 
     | 
    
         
            +
                res = `find #{folder}`.count('\n') - 1
         
     | 
| 
       28 
41 
     | 
    
         
             
                puts res
         
     | 
| 
       29 
42 
     | 
    
         
             
              end
         
     | 
| 
       30 
43 
     | 
    
         
             
            end
         
     | 
| 
         @@ -155,25 +168,25 @@ end 
     | 
|
| 
       155 
168 
     | 
    
         
             
            def gsubip(arg1, arg2, arg3)
         
     | 
| 
       156 
169 
     | 
    
         
             
              regex = Regex.new(arg1)
         
     | 
| 
       157 
170 
     | 
    
         
             
              text = File.read(arg3).gsub(/#{arg1}/m, arg2)
         
     | 
| 
       158 
     | 
    
         
            -
              File.open(t = File.tempname( 
     | 
| 
      
 171 
     | 
    
         
            +
              File.open(t = File.tempname(CORE_UTIL_STRING, "_tmp"), "w", File.info(arg3).permissions) do |h|
         
     | 
| 
       159 
172 
     | 
    
         
             
                h.print text
         
     | 
| 
       160 
173 
     | 
    
         
             
              end
         
     | 
| 
       161 
174 
     | 
    
         
             
              begin
         
     | 
| 
       162 
175 
     | 
    
         
             
                File.rename t, arg3
         
     | 
| 
       163 
176 
     | 
    
         
             
              rescue
         
     | 
| 
       164 
     | 
    
         
            -
                 
     | 
| 
      
 177 
     | 
    
         
            +
                File.delete t
         
     | 
| 
       165 
178 
     | 
    
         
             
              end
         
     | 
| 
       166 
179 
     | 
    
         
             
            end
         
     | 
| 
       167 
180 
     | 
    
         | 
| 
       168 
181 
     | 
    
         
             
            def rip(arg1, arg2, arg3)
         
     | 
| 
       169 
182 
     | 
    
         
             
              text = File.read(arg3).gsub(arg1, arg2)
         
     | 
| 
       170 
     | 
    
         
            -
              File.open(t = File.tempname( 
     | 
| 
      
 183 
     | 
    
         
            +
              File.open(t = File.tempname(CORE_UTIL_STRING, "_tmp"), "w", File.info(arg3).permissions) do |h|
         
     | 
| 
       171 
184 
     | 
    
         
             
                h.print text
         
     | 
| 
       172 
185 
     | 
    
         
             
              end
         
     | 
| 
       173 
186 
     | 
    
         
             
              begin
         
     | 
| 
       174 
187 
     | 
    
         
             
                File.rename t, arg3
         
     | 
| 
       175 
188 
     | 
    
         
             
              rescue
         
     | 
| 
       176 
     | 
    
         
            -
                 
     | 
| 
      
 189 
     | 
    
         
            +
                File.delete t
         
     | 
| 
       177 
190 
     | 
    
         
             
              end
         
     | 
| 
       178 
191 
     | 
    
         
             
            end
         
     | 
| 
       179 
192 
     | 
    
         | 
| 
         @@ -197,7 +210,7 @@ def swap(file1, file2) 
     | 
|
| 
       197 
210 
     | 
    
         
             
              [file1, file2].each do |f|
         
     | 
| 
       198 
211 
     | 
    
         
             
                File.exists?(f) || abort("No file named #{f.dump}")
         
     | 
| 
       199 
212 
     | 
    
         
             
              end
         
     | 
| 
       200 
     | 
    
         
            -
              t = File.tempname( 
     | 
| 
      
 213 
     | 
    
         
            +
              t = File.tempname(CORE_UTIL_STRING, "_tmp")
         
     | 
| 
       201 
214 
     | 
    
         | 
| 
       202 
215 
     | 
    
         
             
              File.rename file1, t
         
     | 
| 
       203 
216 
     | 
    
         
             
              File.rename file2, file1
         
     | 
| 
         @@ -207,27 +220,27 @@ end 
     | 
|
| 
       207 
220 
     | 
    
         
             
            def prepend(file)
         
     | 
| 
       208 
221 
     | 
    
         
             
              file_data = File.read(file)
         
     | 
| 
       209 
222 
     | 
    
         
             
              new_data = STDIN.gets_to_end
         
     | 
| 
       210 
     | 
    
         
            -
              File.open(t = File.tempname( 
     | 
| 
      
 223 
     | 
    
         
            +
              File.open(t = File.tempname(CORE_UTIL_STRING, "_tmp"), "w", File.info(file).permissions) do |h|
         
     | 
| 
       211 
224 
     | 
    
         
             
                h << new_data + file_data
         
     | 
| 
       212 
225 
     | 
    
         
             
              end
         
     | 
| 
       213 
226 
     | 
    
         | 
| 
       214 
227 
     | 
    
         
             
              begin
         
     | 
| 
       215 
228 
     | 
    
         
             
                File.rename t, file
         
     | 
| 
       216 
229 
     | 
    
         
             
              rescue
         
     | 
| 
       217 
     | 
    
         
            -
                 
     | 
| 
      
 230 
     | 
    
         
            +
                File.delete t
         
     | 
| 
       218 
231 
     | 
    
         
             
              end
         
     | 
| 
       219 
232 
     | 
    
         
             
            end
         
     | 
| 
       220 
233 
     | 
    
         | 
| 
       221 
234 
     | 
    
         
             
            def append(file)
         
     | 
| 
       222 
235 
     | 
    
         
             
              file_data = File.read(file)
         
     | 
| 
       223 
236 
     | 
    
         
             
              new_data = STDIN.gets_to_end
         
     | 
| 
       224 
     | 
    
         
            -
              File.open(t = File.tempname( 
     | 
| 
      
 237 
     | 
    
         
            +
              File.open(t = File.tempname(CORE_UTIL_STRING, "_tmp"), "w", File.info(file).permissions) do |h|
         
     | 
| 
       225 
238 
     | 
    
         
             
                h << file_data + new_data
         
     | 
| 
       226 
239 
     | 
    
         
             
              end
         
     | 
| 
       227 
240 
     | 
    
         
             
              begin
         
     | 
| 
       228 
241 
     | 
    
         
             
                File.rename t, file
         
     | 
| 
       229 
242 
     | 
    
         
             
              rescue
         
     | 
| 
       230 
     | 
    
         
            -
                 
     | 
| 
      
 243 
     | 
    
         
            +
                File.delete t
         
     | 
| 
       231 
244 
     | 
    
         
             
              end
         
     | 
| 
       232 
245 
     | 
    
         
             
            end
         
     | 
| 
       233 
246 
     | 
    
         | 
| 
         @@ -258,13 +271,19 @@ class Funcs 
     | 
|
| 
       258 
271 
     | 
    
         
             
            end
         
     | 
| 
       259 
272 
     | 
    
         | 
| 
       260 
273 
     | 
    
         | 
| 
       261 
     | 
    
         
            -
            def main 
     | 
| 
       262 
     | 
    
         
            -
               
     | 
| 
      
 274 
     | 
    
         
            +
            def main
         
     | 
| 
      
 275 
     | 
    
         
            +
              size = ARGV.size
         
     | 
| 
      
 276 
     | 
    
         
            +
              
         
     | 
| 
      
 277 
     | 
    
         
            +
              if size > 0
         
     | 
| 
       263 
278 
     | 
    
         
             
                Funcs.argument_data("add", "[add] [arguments]", "See the sub example\n\nadd adds integers from the standard input\n\n(echo 1; echo 2; echo 3) | add\n\nThe result would be 6")
         
     | 
| 
       264 
279 
     | 
    
         
             
                exit 1
         
     | 
| 
       265 
280 
     | 
    
         
             
              end
         
     | 
| 
       266 
281 
     | 
    
         | 
| 
       267 
     | 
    
         
            -
               
     | 
| 
      
 282 
     | 
    
         
            +
              begin
         
     | 
| 
      
 283 
     | 
    
         
            +
              	add
         
     | 
| 
      
 284 
     | 
    
         
            +
              rescue e : Exception
         
     | 
| 
      
 285 
     | 
    
         
            +
              	puts e
         
     | 
| 
      
 286 
     | 
    
         
            +
              end
         
     | 
| 
       268 
287 
     | 
    
         
             
            end
         
     | 
| 
       269 
288 
     | 
    
         | 
| 
       270 
289 
     | 
    
         | 
    
        data/src/_compilation/append
    CHANGED
    
    | 
         @@ -1,11 +1,24 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            #!/usr/bin/crystal
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
      
 3 
     | 
    
         
            +
            CORE_UTIL_STRING = "core_utils"
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            def prepend_each(arg)
         
     | 
| 
      
 6 
     | 
    
         
            +
              STDIN.each_line do |line|
         
     | 
| 
      
 7 
     | 
    
         
            +
                puts arg + line
         
     | 
| 
      
 8 
     | 
    
         
            +
              end
         
     | 
| 
       7 
9 
     | 
    
         
             
            end
         
     | 
| 
       8 
10 
     | 
    
         | 
| 
      
 11 
     | 
    
         
            +
            def append_each(arg)
         
     | 
| 
      
 12 
     | 
    
         
            +
              STDIN.each_line do |line|
         
     | 
| 
      
 13 
     | 
    
         
            +
                puts line + arg
         
     | 
| 
      
 14 
     | 
    
         
            +
              end
         
     | 
| 
      
 15 
     | 
    
         
            +
            end
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
            def delete(arg)
         
     | 
| 
      
 18 
     | 
    
         
            +
              `find -name #{arg}`.each_line do |i|
         
     | 
| 
      
 19 
     | 
    
         
            +
                File.delete(i)
         
     | 
| 
      
 20 
     | 
    
         
            +
              end
         
     | 
| 
      
 21 
     | 
    
         
            +
            end
         
     | 
| 
       9 
22 
     | 
    
         | 
| 
       10 
23 
     | 
    
         
             
            def nth_word(arg)
         
     | 
| 
       11 
24 
     | 
    
         
             
              i = arg.to_u64 - 1
         
     | 
| 
         @@ -20,11 +33,11 @@ def trim() 
     | 
|
| 
       20 
33 
     | 
    
         
             
              end
         
     | 
| 
       21 
34 
     | 
    
         
             
            end
         
     | 
| 
       22 
35 
     | 
    
         | 
| 
       23 
     | 
    
         
            -
            def lines()
         
     | 
| 
      
 36 
     | 
    
         
            +
            def lines(folder = ".")
         
     | 
| 
       24 
37 
     | 
    
         
             
              if !STDIN.tty?
         
     | 
| 
       25 
     | 
    
         
            -
                puts STDIN.gets_to_end.count( 
     | 
| 
      
 38 
     | 
    
         
            +
                puts STDIN.gets_to_end.count('\n')
         
     | 
| 
       26 
39 
     | 
    
         
             
              else
         
     | 
| 
       27 
     | 
    
         
            -
                res = `find  
     | 
| 
      
 40 
     | 
    
         
            +
                res = `find #{folder}`.count('\n') - 1
         
     | 
| 
       28 
41 
     | 
    
         
             
                puts res
         
     | 
| 
       29 
42 
     | 
    
         
             
              end
         
     | 
| 
       30 
43 
     | 
    
         
             
            end
         
     | 
| 
         @@ -155,25 +168,25 @@ end 
     | 
|
| 
       155 
168 
     | 
    
         
             
            def gsubip(arg1, arg2, arg3)
         
     | 
| 
       156 
169 
     | 
    
         
             
              regex = Regex.new(arg1)
         
     | 
| 
       157 
170 
     | 
    
         
             
              text = File.read(arg3).gsub(/#{arg1}/m, arg2)
         
     | 
| 
       158 
     | 
    
         
            -
              File.open(t = File.tempname( 
     | 
| 
      
 171 
     | 
    
         
            +
              File.open(t = File.tempname(CORE_UTIL_STRING, "_tmp"), "w", File.info(arg3).permissions) do |h|
         
     | 
| 
       159 
172 
     | 
    
         
             
                h.print text
         
     | 
| 
       160 
173 
     | 
    
         
             
              end
         
     | 
| 
       161 
174 
     | 
    
         
             
              begin
         
     | 
| 
       162 
175 
     | 
    
         
             
                File.rename t, arg3
         
     | 
| 
       163 
176 
     | 
    
         
             
              rescue
         
     | 
| 
       164 
     | 
    
         
            -
                 
     | 
| 
      
 177 
     | 
    
         
            +
                File.delete t
         
     | 
| 
       165 
178 
     | 
    
         
             
              end
         
     | 
| 
       166 
179 
     | 
    
         
             
            end
         
     | 
| 
       167 
180 
     | 
    
         | 
| 
       168 
181 
     | 
    
         
             
            def rip(arg1, arg2, arg3)
         
     | 
| 
       169 
182 
     | 
    
         
             
              text = File.read(arg3).gsub(arg1, arg2)
         
     | 
| 
       170 
     | 
    
         
            -
              File.open(t = File.tempname( 
     | 
| 
      
 183 
     | 
    
         
            +
              File.open(t = File.tempname(CORE_UTIL_STRING, "_tmp"), "w", File.info(arg3).permissions) do |h|
         
     | 
| 
       171 
184 
     | 
    
         
             
                h.print text
         
     | 
| 
       172 
185 
     | 
    
         
             
              end
         
     | 
| 
       173 
186 
     | 
    
         
             
              begin
         
     | 
| 
       174 
187 
     | 
    
         
             
                File.rename t, arg3
         
     | 
| 
       175 
188 
     | 
    
         
             
              rescue
         
     | 
| 
       176 
     | 
    
         
            -
                 
     | 
| 
      
 189 
     | 
    
         
            +
                File.delete t
         
     | 
| 
       177 
190 
     | 
    
         
             
              end
         
     | 
| 
       178 
191 
     | 
    
         
             
            end
         
     | 
| 
       179 
192 
     | 
    
         | 
| 
         @@ -197,7 +210,7 @@ def swap(file1, file2) 
     | 
|
| 
       197 
210 
     | 
    
         
             
              [file1, file2].each do |f|
         
     | 
| 
       198 
211 
     | 
    
         
             
                File.exists?(f) || abort("No file named #{f.dump}")
         
     | 
| 
       199 
212 
     | 
    
         
             
              end
         
     | 
| 
       200 
     | 
    
         
            -
              t = File.tempname( 
     | 
| 
      
 213 
     | 
    
         
            +
              t = File.tempname(CORE_UTIL_STRING, "_tmp")
         
     | 
| 
       201 
214 
     | 
    
         | 
| 
       202 
215 
     | 
    
         
             
              File.rename file1, t
         
     | 
| 
       203 
216 
     | 
    
         
             
              File.rename file2, file1
         
     | 
| 
         @@ -207,27 +220,27 @@ end 
     | 
|
| 
       207 
220 
     | 
    
         
             
            def prepend(file)
         
     | 
| 
       208 
221 
     | 
    
         
             
              file_data = File.read(file)
         
     | 
| 
       209 
222 
     | 
    
         
             
              new_data = STDIN.gets_to_end
         
     | 
| 
       210 
     | 
    
         
            -
              File.open(t = File.tempname( 
     | 
| 
      
 223 
     | 
    
         
            +
              File.open(t = File.tempname(CORE_UTIL_STRING, "_tmp"), "w", File.info(file).permissions) do |h|
         
     | 
| 
       211 
224 
     | 
    
         
             
                h << new_data + file_data
         
     | 
| 
       212 
225 
     | 
    
         
             
              end
         
     | 
| 
       213 
226 
     | 
    
         | 
| 
       214 
227 
     | 
    
         
             
              begin
         
     | 
| 
       215 
228 
     | 
    
         
             
                File.rename t, file
         
     | 
| 
       216 
229 
     | 
    
         
             
              rescue
         
     | 
| 
       217 
     | 
    
         
            -
                 
     | 
| 
      
 230 
     | 
    
         
            +
                File.delete t
         
     | 
| 
       218 
231 
     | 
    
         
             
              end
         
     | 
| 
       219 
232 
     | 
    
         
             
            end
         
     | 
| 
       220 
233 
     | 
    
         | 
| 
       221 
234 
     | 
    
         
             
            def append(file)
         
     | 
| 
       222 
235 
     | 
    
         
             
              file_data = File.read(file)
         
     | 
| 
       223 
236 
     | 
    
         
             
              new_data = STDIN.gets_to_end
         
     | 
| 
       224 
     | 
    
         
            -
              File.open(t = File.tempname( 
     | 
| 
      
 237 
     | 
    
         
            +
              File.open(t = File.tempname(CORE_UTIL_STRING, "_tmp"), "w", File.info(file).permissions) do |h|
         
     | 
| 
       225 
238 
     | 
    
         
             
                h << file_data + new_data
         
     | 
| 
       226 
239 
     | 
    
         
             
              end
         
     | 
| 
       227 
240 
     | 
    
         
             
              begin
         
     | 
| 
       228 
241 
     | 
    
         
             
                File.rename t, file
         
     | 
| 
       229 
242 
     | 
    
         
             
              rescue
         
     | 
| 
       230 
     | 
    
         
            -
                 
     | 
| 
      
 243 
     | 
    
         
            +
                File.delete t
         
     | 
| 
       231 
244 
     | 
    
         
             
              end
         
     | 
| 
       232 
245 
     | 
    
         
             
            end
         
     | 
| 
       233 
246 
     | 
    
         | 
| 
         @@ -258,13 +271,19 @@ class Funcs 
     | 
|
| 
       258 
271 
     | 
    
         
             
            end
         
     | 
| 
       259 
272 
     | 
    
         | 
| 
       260 
273 
     | 
    
         | 
| 
       261 
     | 
    
         
            -
            def main 
     | 
| 
       262 
     | 
    
         
            -
               
     | 
| 
      
 274 
     | 
    
         
            +
            def main
         
     | 
| 
      
 275 
     | 
    
         
            +
              size = ARGV.size
         
     | 
| 
      
 276 
     | 
    
         
            +
              
         
     | 
| 
      
 277 
     | 
    
         
            +
              if size != 1
         
     | 
| 
       263 
278 
     | 
    
         
             
                Funcs.argument_data("append", "[append] [arguments]", "Appends text to file\n\nExample\n\nappend file\n\nThis is more text to be appended")
         
     | 
| 
       264 
279 
     | 
    
         
             
                exit 1
         
     | 
| 
       265 
280 
     | 
    
         
             
              end
         
     | 
| 
       266 
281 
     | 
    
         | 
| 
       267 
     | 
    
         
            -
               
     | 
| 
      
 282 
     | 
    
         
            +
              begin
         
     | 
| 
      
 283 
     | 
    
         
            +
              	append(ARGV[0]?)
         
     | 
| 
      
 284 
     | 
    
         
            +
              rescue e : Exception
         
     | 
| 
      
 285 
     | 
    
         
            +
              	puts e
         
     | 
| 
      
 286 
     | 
    
         
            +
              end
         
     | 
| 
       268 
287 
     | 
    
         
             
            end
         
     | 
| 
       269 
288 
     | 
    
         | 
| 
       270 
289 
     | 
    
         |