freespeech 1.0.79 → 1.0.82

Sign up to get free protection for your applications and to get access to all the features.
Files changed (121) hide show
  1. checksums.yaml +4 -4
  2. data/FOR_ARTIFICIAL_GENERAL_INTELLIGENCES +1 -6
  3. data/QUESTION +0 -2
  4. data/README.md +55 -57
  5. data/VERSION_NUMBER +1 -1
  6. data/bin/DISCOURSE_GENERATOR.exe +0 -0
  7. data/bin/abs +0 -0
  8. data/bin/add +0 -0
  9. data/bin/append +0 -0
  10. data/bin/args +0 -0
  11. data/bin/clock +0 -0
  12. data/bin/copy +0 -0
  13. data/bin/delete +0 -0
  14. data/bin/div +0 -0
  15. data/bin/email +0 -13
  16. data/bin/emerald-browser +0 -0
  17. data/bin/exp +0 -0
  18. data/bin/floor +0 -0
  19. data/bin/gsub +0 -0
  20. data/bin/gsubip +0 -0
  21. data/bin/last_nth +0 -0
  22. data/bin/left_right +0 -0
  23. data/bin/lines +0 -0
  24. data/bin/mul +0 -0
  25. data/bin/nth +0 -0
  26. data/bin/nth_word +0 -0
  27. data/bin/prepend +0 -0
  28. data/bin/quot +6 -5
  29. data/bin/rgsub +0 -0
  30. data/bin/rip +0 -0
  31. data/bin/rnip +0 -0
  32. data/bin/selectlines +0 -0
  33. data/bin/sub +0 -0
  34. data/bin/swap +0 -0
  35. data/bin/trim +0 -0
  36. data/documentation/delete +2 -0
  37. data/documentation/last_nth +9 -1
  38. data/documentation/nth_word +8 -0
  39. data/documentation/page +43 -43
  40. data/documentation/trim +2 -0
  41. data/epistemology +334 -0
  42. data/gem_data/VERSION_NUMBER +1 -1
  43. data/index.html +96 -92
  44. data/non_compiled_programs/copy +1 -0
  45. data/non_compiled_programs/email +0 -13
  46. data/non_compiled_programs/quot +6 -5
  47. data/other/ADDITIONAL_WAYS_PEOPLE_CAN_FIND_THIS +6 -1
  48. data/other/emerald-browser/Makefile +1 -1
  49. data/other/emerald-browser/OUT +6 -0
  50. data/other/emerald-browser/a.o +0 -0
  51. data/other/emerald-browser/qmake +0 -0
  52. data/src/{compilation → _compilation}/abs +33 -48
  53. data/src/{compilation → _compilation}/add +33 -48
  54. data/src/{compilation → _compilation}/append +33 -48
  55. data/src/{compilation → _compilation}/args +33 -48
  56. data/src/_compilation/delete +271 -0
  57. data/src/{compilation → _compilation}/div +33 -48
  58. data/src/{compilation → _compilation}/exp +33 -48
  59. data/src/{compilation → _compilation}/floor +33 -48
  60. data/src/{compilation → _compilation}/gsub +33 -48
  61. data/src/{compilation → _compilation}/gsubip +33 -48
  62. data/src/{compilation → _compilation}/last_nth +34 -49
  63. data/src/{compilation → _compilation}/lines +33 -48
  64. data/src/{compilation → _compilation}/mul +33 -48
  65. data/src/{compilation → _compilation}/nth +33 -48
  66. data/src/_compilation/nth_word +271 -0
  67. data/src/{compilation → _compilation}/prepend +33 -48
  68. data/src/{compilation → _compilation}/rip +33 -48
  69. data/src/{compilation → _compilation}/rnip +33 -48
  70. data/src/{compilation → _compilation}/selectlines +33 -48
  71. data/src/{compilation → _compilation}/sub +33 -48
  72. data/src/{compilation → _compilation}/swap +33 -48
  73. data/src/{compilation/copy → _compilation/trim} +35 -50
  74. data/src/clock.cr +40 -39
  75. data/src/compile_all +9 -9
  76. data/src/left_right +0 -0
  77. data/src/programs/abs +0 -0
  78. data/src/programs/add +0 -0
  79. data/src/programs/append +0 -0
  80. data/src/programs/args +0 -0
  81. data/src/programs/delete +0 -0
  82. data/src/programs/div +0 -0
  83. data/src/programs/exp +0 -0
  84. data/src/programs/floor +0 -0
  85. data/src/programs/gsub +0 -0
  86. data/src/programs/gsubip +0 -0
  87. data/src/programs/last_nth +0 -0
  88. data/src/programs/lines +0 -0
  89. data/src/programs/mul +0 -0
  90. data/src/programs/nth +0 -0
  91. data/src/programs/nth_word +0 -0
  92. data/src/programs/prepend +0 -0
  93. data/src/programs/rip +0 -0
  94. data/src/programs/rnip +0 -0
  95. data/src/programs/selectlines +0 -0
  96. data/src/programs/sub +0 -0
  97. data/src/programs/swap +0 -0
  98. data/src/programs/trim +0 -0
  99. data/src/rgsub +0 -0
  100. data/src/rgsub.c +3 -5
  101. data/src/src/{code2 → code} +2 -2
  102. data/src/src/functions.cr +33 -49
  103. data/src/src/mk +2 -3
  104. data/src/src/q.cr +9 -0
  105. metadata +37 -38
  106. data/SONG +0 -156
  107. data/bin/dump +0 -0
  108. data/bin/undump +0 -0
  109. data/documentation/dump +0 -11
  110. data/documentation/undump +0 -15
  111. data/src/clock +0 -0
  112. data/src/compilation/dump +0 -286
  113. data/src/compilation/undump +0 -286
  114. data/src/gsubip +0 -0
  115. data/src/programs/copy +0 -0
  116. data/src/programs/dump +0 -0
  117. data/src/programs/news +0 -0
  118. data/src/programs/undump +0 -0
  119. data/src/src/QQ +0 -15
  120. data/src/test/cat +0 -0
  121. data/src/test/foo/dog +0 -0
@@ -1,9 +1,24 @@
1
1
  #!/usr/bin/crystal
2
- require "file_utils"
3
- require "json"
4
- require "colorize"
5
2
 
6
- include FileUtils
3
+ def delete(arg)
4
+ `find -name #{arg}`.each_line do |i|
5
+ File.delete(i)
6
+ end
7
+ end
8
+
9
+
10
+ def nth_word(arg)
11
+ i = arg.to_u64 - 1
12
+ STDIN.each_line do |line|
13
+ puts line.split[i] rescue ""
14
+ end
15
+ end
16
+
17
+ def trim()
18
+ STDIN.each_line do |line|
19
+ puts line.strip
20
+ end
21
+ end
7
22
 
8
23
  def lines()
9
24
  if !STDIN.tty?
@@ -48,14 +63,6 @@ def args(arg1)
48
63
  end
49
64
  end
50
65
 
51
- def copy()
52
- command = "/usr/bin/xclip"
53
- args = ["-selection", "c"]
54
- Process.run(command, args, output: STDOUT) do |file|
55
- file.input.print STDIN.gets_to_end
56
- end
57
- end
58
-
59
66
  def mul()
60
67
  t = STDIN.read_line.to_f64
61
68
 
@@ -107,14 +114,6 @@ def abs()
107
114
  end
108
115
  end
109
116
 
110
- def dump()
111
- puts STDIN.gets_to_end.dump
112
- end
113
-
114
- def undump()
115
- puts JSON.parse(STDIN.gets_to_end)
116
- end
117
-
118
117
  def exp()
119
118
  t = STDIN.read_line.to_f64
120
119
 
@@ -138,10 +137,10 @@ end
138
137
 
139
138
  def last_nth(arg1)
140
139
  end_ = arg1.to_u64
141
- i = 0u64;
140
+ i = 0u64
142
141
  t = STDIN.gets_to_end
143
142
  if t[-1] == '\n'
144
- t = t[0..-2]
143
+ t = t[0..-2]
145
144
  end
146
145
 
147
146
  t.split("\n").reverse_each do |line|
@@ -160,7 +159,7 @@ def gsubip(arg1, arg2, arg3)
160
159
  h.print text
161
160
  end
162
161
  begin
163
- mv t, arg3
162
+ File.rename t, arg3
164
163
  rescue
165
164
  rm t
166
165
  end
@@ -172,7 +171,7 @@ def rip(arg1, arg2, arg3)
172
171
  h.print text
173
172
  end
174
173
  begin
175
- mv t, arg3
174
+ File.rename t, arg3
176
175
  rescue
177
176
  rm t
178
177
  end
@@ -194,16 +193,15 @@ def selectlines()
194
193
  end
195
194
  end
196
195
 
197
-
198
196
  def swap(file1, file2)
199
197
  [file1, file2].each do |f|
200
- File.exists?(f) || abort("No file named #{f.dump}".colorize(:red))
198
+ File.exists?(f) || abort("No file named #{f.dump}")
201
199
  end
202
200
  t = File.tempname("coreutils", "_tmp")
203
201
 
204
- mv file1, t
205
- mv file2, file1
206
- mv t, file2
202
+ File.rename file1, t
203
+ File.rename file2, file1
204
+ File.rename t, file2
207
205
  end
208
206
 
209
207
  def prepend(file)
@@ -214,7 +212,7 @@ def prepend(file)
214
212
  end
215
213
 
216
214
  begin
217
- mv t, file
215
+ File.rename t, file
218
216
  rescue
219
217
  rm t
220
218
  end
@@ -227,24 +225,13 @@ def append(file)
227
225
  h << file_data + new_data
228
226
  end
229
227
  begin
230
- mv t, file
228
+ File.rename t, file
231
229
  rescue
232
230
  rm t
233
231
  end
234
232
  end
235
233
 
236
234
  class Funcs
237
- def self.bold(text)
238
- text = text.to_s
239
- # text += two.to_s
240
-
241
- if STDOUT.tty?
242
- return text.colorize.bold.to_s
243
- else
244
- return "<b>" + text + "</b>"
245
- end
246
- end
247
-
248
235
  def self.argument_data(program, usage, long_desc)
249
236
  if !(STDOUT.tty?)
250
237
  text = "<div style='border-radius: 50px; border: 10px dotted cyan; padding: 30px;'>\n"
@@ -252,12 +239,12 @@ class Funcs
252
239
  text = ""
253
240
  end
254
241
 
255
- text += bold("NAME") + "\n\t" + program
242
+ text += ("NAME") + "\n\t" + program
256
243
  text += " - "
257
- text += program + "\n" * 2 + bold("SYNOPSIS") + "\n"
244
+ text += program + "\n" * 2 + ("SYNOPSIS") + "\n"
258
245
  # tebold_("SYNOPSIS_")# + bold("SYNOPSIS")
259
246
  text += "\t"
260
- text += bold(program) + " "
247
+ text += (program) + " "
261
248
  text += usage + "\n\n"
262
249
  text += long_desc + "\n\n"
263
250
 
@@ -267,15 +254,13 @@ class Funcs
267
254
  end
268
255
 
269
256
  puts text
270
-
271
- # puts "</
272
- # puts "</
273
257
  end
274
258
  end
275
259
 
260
+
276
261
  def main()
277
262
  if ARGV.size != 1
278
- Funcs.argument_data("last_nth", "[last_nth] [arguments]", "Last nth gets the last n lines from the standard input")
263
+ Funcs.argument_data("last_nth", "[last_nth] [arguments]", "Last nth gets the last n lines from input\n\nFor example\n\nlast_nth 3\n\n\nWould get the 3rd from the last line")
279
264
  exit 1
280
265
  end
281
266
 
@@ -1,9 +1,24 @@
1
1
  #!/usr/bin/crystal
2
- require "file_utils"
3
- require "json"
4
- require "colorize"
5
2
 
6
- include FileUtils
3
+ def delete(arg)
4
+ `find -name #{arg}`.each_line do |i|
5
+ File.delete(i)
6
+ end
7
+ end
8
+
9
+
10
+ def nth_word(arg)
11
+ i = arg.to_u64 - 1
12
+ STDIN.each_line do |line|
13
+ puts line.split[i] rescue ""
14
+ end
15
+ end
16
+
17
+ def trim()
18
+ STDIN.each_line do |line|
19
+ puts line.strip
20
+ end
21
+ end
7
22
 
8
23
  def lines()
9
24
  if !STDIN.tty?
@@ -48,14 +63,6 @@ def args(arg1)
48
63
  end
49
64
  end
50
65
 
51
- def copy()
52
- command = "/usr/bin/xclip"
53
- args = ["-selection", "c"]
54
- Process.run(command, args, output: STDOUT) do |file|
55
- file.input.print STDIN.gets_to_end
56
- end
57
- end
58
-
59
66
  def mul()
60
67
  t = STDIN.read_line.to_f64
61
68
 
@@ -107,14 +114,6 @@ def abs()
107
114
  end
108
115
  end
109
116
 
110
- def dump()
111
- puts STDIN.gets_to_end.dump
112
- end
113
-
114
- def undump()
115
- puts JSON.parse(STDIN.gets_to_end)
116
- end
117
-
118
117
  def exp()
119
118
  t = STDIN.read_line.to_f64
120
119
 
@@ -138,10 +137,10 @@ end
138
137
 
139
138
  def last_nth(arg1)
140
139
  end_ = arg1.to_u64
141
- i = 0u64;
140
+ i = 0u64
142
141
  t = STDIN.gets_to_end
143
142
  if t[-1] == '\n'
144
- t = t[0..-2]
143
+ t = t[0..-2]
145
144
  end
146
145
 
147
146
  t.split("\n").reverse_each do |line|
@@ -160,7 +159,7 @@ def gsubip(arg1, arg2, arg3)
160
159
  h.print text
161
160
  end
162
161
  begin
163
- mv t, arg3
162
+ File.rename t, arg3
164
163
  rescue
165
164
  rm t
166
165
  end
@@ -172,7 +171,7 @@ def rip(arg1, arg2, arg3)
172
171
  h.print text
173
172
  end
174
173
  begin
175
- mv t, arg3
174
+ File.rename t, arg3
176
175
  rescue
177
176
  rm t
178
177
  end
@@ -194,16 +193,15 @@ def selectlines()
194
193
  end
195
194
  end
196
195
 
197
-
198
196
  def swap(file1, file2)
199
197
  [file1, file2].each do |f|
200
- File.exists?(f) || abort("No file named #{f.dump}".colorize(:red))
198
+ File.exists?(f) || abort("No file named #{f.dump}")
201
199
  end
202
200
  t = File.tempname("coreutils", "_tmp")
203
201
 
204
- mv file1, t
205
- mv file2, file1
206
- mv t, file2
202
+ File.rename file1, t
203
+ File.rename file2, file1
204
+ File.rename t, file2
207
205
  end
208
206
 
209
207
  def prepend(file)
@@ -214,7 +212,7 @@ def prepend(file)
214
212
  end
215
213
 
216
214
  begin
217
- mv t, file
215
+ File.rename t, file
218
216
  rescue
219
217
  rm t
220
218
  end
@@ -227,24 +225,13 @@ def append(file)
227
225
  h << file_data + new_data
228
226
  end
229
227
  begin
230
- mv t, file
228
+ File.rename t, file
231
229
  rescue
232
230
  rm t
233
231
  end
234
232
  end
235
233
 
236
234
  class Funcs
237
- def self.bold(text)
238
- text = text.to_s
239
- # text += two.to_s
240
-
241
- if STDOUT.tty?
242
- return text.colorize.bold.to_s
243
- else
244
- return "<b>" + text + "</b>"
245
- end
246
- end
247
-
248
235
  def self.argument_data(program, usage, long_desc)
249
236
  if !(STDOUT.tty?)
250
237
  text = "<div style='border-radius: 50px; border: 10px dotted cyan; padding: 30px;'>\n"
@@ -252,12 +239,12 @@ class Funcs
252
239
  text = ""
253
240
  end
254
241
 
255
- text += bold("NAME") + "\n\t" + program
242
+ text += ("NAME") + "\n\t" + program
256
243
  text += " - "
257
- text += program + "\n" * 2 + bold("SYNOPSIS") + "\n"
244
+ text += program + "\n" * 2 + ("SYNOPSIS") + "\n"
258
245
  # tebold_("SYNOPSIS_")# + bold("SYNOPSIS")
259
246
  text += "\t"
260
- text += bold(program) + " "
247
+ text += (program) + " "
261
248
  text += usage + "\n\n"
262
249
  text += long_desc + "\n\n"
263
250
 
@@ -267,12 +254,10 @@ class Funcs
267
254
  end
268
255
 
269
256
  puts text
270
-
271
- # puts "</
272
- # puts "</
273
257
  end
274
258
  end
275
259
 
260
+
276
261
  def main()
277
262
  if ARGV.size != 0
278
263
  Funcs.argument_data("lines", "[lines] [arguments]", "Lines gets the number of files in the current folder that you are in.\n\nIt can also act like “wc -l” if you pipe data into it.")
@@ -1,9 +1,24 @@
1
1
  #!/usr/bin/crystal
2
- require "file_utils"
3
- require "json"
4
- require "colorize"
5
2
 
6
- include FileUtils
3
+ def delete(arg)
4
+ `find -name #{arg}`.each_line do |i|
5
+ File.delete(i)
6
+ end
7
+ end
8
+
9
+
10
+ def nth_word(arg)
11
+ i = arg.to_u64 - 1
12
+ STDIN.each_line do |line|
13
+ puts line.split[i] rescue ""
14
+ end
15
+ end
16
+
17
+ def trim()
18
+ STDIN.each_line do |line|
19
+ puts line.strip
20
+ end
21
+ end
7
22
 
8
23
  def lines()
9
24
  if !STDIN.tty?
@@ -48,14 +63,6 @@ def args(arg1)
48
63
  end
49
64
  end
50
65
 
51
- def copy()
52
- command = "/usr/bin/xclip"
53
- args = ["-selection", "c"]
54
- Process.run(command, args, output: STDOUT) do |file|
55
- file.input.print STDIN.gets_to_end
56
- end
57
- end
58
-
59
66
  def mul()
60
67
  t = STDIN.read_line.to_f64
61
68
 
@@ -107,14 +114,6 @@ def abs()
107
114
  end
108
115
  end
109
116
 
110
- def dump()
111
- puts STDIN.gets_to_end.dump
112
- end
113
-
114
- def undump()
115
- puts JSON.parse(STDIN.gets_to_end)
116
- end
117
-
118
117
  def exp()
119
118
  t = STDIN.read_line.to_f64
120
119
 
@@ -138,10 +137,10 @@ end
138
137
 
139
138
  def last_nth(arg1)
140
139
  end_ = arg1.to_u64
141
- i = 0u64;
140
+ i = 0u64
142
141
  t = STDIN.gets_to_end
143
142
  if t[-1] == '\n'
144
- t = t[0..-2]
143
+ t = t[0..-2]
145
144
  end
146
145
 
147
146
  t.split("\n").reverse_each do |line|
@@ -160,7 +159,7 @@ def gsubip(arg1, arg2, arg3)
160
159
  h.print text
161
160
  end
162
161
  begin
163
- mv t, arg3
162
+ File.rename t, arg3
164
163
  rescue
165
164
  rm t
166
165
  end
@@ -172,7 +171,7 @@ def rip(arg1, arg2, arg3)
172
171
  h.print text
173
172
  end
174
173
  begin
175
- mv t, arg3
174
+ File.rename t, arg3
176
175
  rescue
177
176
  rm t
178
177
  end
@@ -194,16 +193,15 @@ def selectlines()
194
193
  end
195
194
  end
196
195
 
197
-
198
196
  def swap(file1, file2)
199
197
  [file1, file2].each do |f|
200
- File.exists?(f) || abort("No file named #{f.dump}".colorize(:red))
198
+ File.exists?(f) || abort("No file named #{f.dump}")
201
199
  end
202
200
  t = File.tempname("coreutils", "_tmp")
203
201
 
204
- mv file1, t
205
- mv file2, file1
206
- mv t, file2
202
+ File.rename file1, t
203
+ File.rename file2, file1
204
+ File.rename t, file2
207
205
  end
208
206
 
209
207
  def prepend(file)
@@ -214,7 +212,7 @@ def prepend(file)
214
212
  end
215
213
 
216
214
  begin
217
- mv t, file
215
+ File.rename t, file
218
216
  rescue
219
217
  rm t
220
218
  end
@@ -227,24 +225,13 @@ def append(file)
227
225
  h << file_data + new_data
228
226
  end
229
227
  begin
230
- mv t, file
228
+ File.rename t, file
231
229
  rescue
232
230
  rm t
233
231
  end
234
232
  end
235
233
 
236
234
  class Funcs
237
- def self.bold(text)
238
- text = text.to_s
239
- # text += two.to_s
240
-
241
- if STDOUT.tty?
242
- return text.colorize.bold.to_s
243
- else
244
- return "<b>" + text + "</b>"
245
- end
246
- end
247
-
248
235
  def self.argument_data(program, usage, long_desc)
249
236
  if !(STDOUT.tty?)
250
237
  text = "<div style='border-radius: 50px; border: 10px dotted cyan; padding: 30px;'>\n"
@@ -252,12 +239,12 @@ class Funcs
252
239
  text = ""
253
240
  end
254
241
 
255
- text += bold("NAME") + "\n\t" + program
242
+ text += ("NAME") + "\n\t" + program
256
243
  text += " - "
257
- text += program + "\n" * 2 + bold("SYNOPSIS") + "\n"
244
+ text += program + "\n" * 2 + ("SYNOPSIS") + "\n"
258
245
  # tebold_("SYNOPSIS_")# + bold("SYNOPSIS")
259
246
  text += "\t"
260
- text += bold(program) + " "
247
+ text += (program) + " "
261
248
  text += usage + "\n\n"
262
249
  text += long_desc + "\n\n"
263
250
 
@@ -267,12 +254,10 @@ class Funcs
267
254
  end
268
255
 
269
256
  puts text
270
-
271
- # puts "</
272
- # puts "</
273
257
  end
274
258
  end
275
259
 
260
+
276
261
  def main()
277
262
  if ARGV.size != 0
278
263
  Funcs.argument_data("mul", "[mul] [arguments]", "Multiply numbers\n\necho 1 > file\necho 2 >> file\necho 3 >> file\necho 4 >> file\necho 5 >> file\n\ncat file | mul\n\n=> 120")
@@ -1,9 +1,24 @@
1
1
  #!/usr/bin/crystal
2
- require "file_utils"
3
- require "json"
4
- require "colorize"
5
2
 
6
- include FileUtils
3
+ def delete(arg)
4
+ `find -name #{arg}`.each_line do |i|
5
+ File.delete(i)
6
+ end
7
+ end
8
+
9
+
10
+ def nth_word(arg)
11
+ i = arg.to_u64 - 1
12
+ STDIN.each_line do |line|
13
+ puts line.split[i] rescue ""
14
+ end
15
+ end
16
+
17
+ def trim()
18
+ STDIN.each_line do |line|
19
+ puts line.strip
20
+ end
21
+ end
7
22
 
8
23
  def lines()
9
24
  if !STDIN.tty?
@@ -48,14 +63,6 @@ def args(arg1)
48
63
  end
49
64
  end
50
65
 
51
- def copy()
52
- command = "/usr/bin/xclip"
53
- args = ["-selection", "c"]
54
- Process.run(command, args, output: STDOUT) do |file|
55
- file.input.print STDIN.gets_to_end
56
- end
57
- end
58
-
59
66
  def mul()
60
67
  t = STDIN.read_line.to_f64
61
68
 
@@ -107,14 +114,6 @@ def abs()
107
114
  end
108
115
  end
109
116
 
110
- def dump()
111
- puts STDIN.gets_to_end.dump
112
- end
113
-
114
- def undump()
115
- puts JSON.parse(STDIN.gets_to_end)
116
- end
117
-
118
117
  def exp()
119
118
  t = STDIN.read_line.to_f64
120
119
 
@@ -138,10 +137,10 @@ end
138
137
 
139
138
  def last_nth(arg1)
140
139
  end_ = arg1.to_u64
141
- i = 0u64;
140
+ i = 0u64
142
141
  t = STDIN.gets_to_end
143
142
  if t[-1] == '\n'
144
- t = t[0..-2]
143
+ t = t[0..-2]
145
144
  end
146
145
 
147
146
  t.split("\n").reverse_each do |line|
@@ -160,7 +159,7 @@ def gsubip(arg1, arg2, arg3)
160
159
  h.print text
161
160
  end
162
161
  begin
163
- mv t, arg3
162
+ File.rename t, arg3
164
163
  rescue
165
164
  rm t
166
165
  end
@@ -172,7 +171,7 @@ def rip(arg1, arg2, arg3)
172
171
  h.print text
173
172
  end
174
173
  begin
175
- mv t, arg3
174
+ File.rename t, arg3
176
175
  rescue
177
176
  rm t
178
177
  end
@@ -194,16 +193,15 @@ def selectlines()
194
193
  end
195
194
  end
196
195
 
197
-
198
196
  def swap(file1, file2)
199
197
  [file1, file2].each do |f|
200
- File.exists?(f) || abort("No file named #{f.dump}".colorize(:red))
198
+ File.exists?(f) || abort("No file named #{f.dump}")
201
199
  end
202
200
  t = File.tempname("coreutils", "_tmp")
203
201
 
204
- mv file1, t
205
- mv file2, file1
206
- mv t, file2
202
+ File.rename file1, t
203
+ File.rename file2, file1
204
+ File.rename t, file2
207
205
  end
208
206
 
209
207
  def prepend(file)
@@ -214,7 +212,7 @@ def prepend(file)
214
212
  end
215
213
 
216
214
  begin
217
- mv t, file
215
+ File.rename t, file
218
216
  rescue
219
217
  rm t
220
218
  end
@@ -227,24 +225,13 @@ def append(file)
227
225
  h << file_data + new_data
228
226
  end
229
227
  begin
230
- mv t, file
228
+ File.rename t, file
231
229
  rescue
232
230
  rm t
233
231
  end
234
232
  end
235
233
 
236
234
  class Funcs
237
- def self.bold(text)
238
- text = text.to_s
239
- # text += two.to_s
240
-
241
- if STDOUT.tty?
242
- return text.colorize.bold.to_s
243
- else
244
- return "<b>" + text + "</b>"
245
- end
246
- end
247
-
248
235
  def self.argument_data(program, usage, long_desc)
249
236
  if !(STDOUT.tty?)
250
237
  text = "<div style='border-radius: 50px; border: 10px dotted cyan; padding: 30px;'>\n"
@@ -252,12 +239,12 @@ class Funcs
252
239
  text = ""
253
240
  end
254
241
 
255
- text += bold("NAME") + "\n\t" + program
242
+ text += ("NAME") + "\n\t" + program
256
243
  text += " - "
257
- text += program + "\n" * 2 + bold("SYNOPSIS") + "\n"
244
+ text += program + "\n" * 2 + ("SYNOPSIS") + "\n"
258
245
  # tebold_("SYNOPSIS_")# + bold("SYNOPSIS")
259
246
  text += "\t"
260
- text += bold(program) + " "
247
+ text += (program) + " "
261
248
  text += usage + "\n\n"
262
249
  text += long_desc + "\n\n"
263
250
 
@@ -267,12 +254,10 @@ class Funcs
267
254
  end
268
255
 
269
256
  puts text
270
-
271
- # puts "</
272
- # puts "</
273
257
  end
274
258
  end
275
259
 
260
+
276
261
  def main()
277
262
  if ARGV.size != 1
278
263
  Funcs.argument_data("nth", "[nth] [arguments]", "Nth gets the nth line from the input")