site-neo/pfiles.rb

55 lines
965 B
Ruby
Raw Normal View History

2023-02-10 14:02:43 -05:00
#!/usr/bin/ruby
# pfiles.rb
2023-02-17 13:17:33 -05:00
# v1.0-p3
2023-02-11 09:08:06 -05:00
require 'find'
2023-02-17 13:17:33 -05:00
ignore=!File.file?('dat/ignore.txt') ? [] : File.readlines('dat/ignore.txt')
2023-02-11 09:08:06 -05:00
if ignore != []
2023-10-27 09:56:04 -04:00
ignore.map! { |i| "in/#{i}" }
2023-02-11 09:08:06 -05:00
end
class Enumerator
2023-10-27 09:36:56 -04:00
def collect
out=Array.new
for i in self
out.push(i)
end
return out
end
2023-02-11 09:08:06 -05:00
end
list=Find.find('in')
l=list.collect
case ARGV.first
when "doc"
2023-10-27 09:36:56 -04:00
for i in l do
next if ignore.include?(i) or /\.v.html/.match?(i)
if /\.(txti|org|md|html)$/.match?(i)
print i
print ' ' unless i==l.last
end
end
2023-02-11 09:08:06 -05:00
when "sass"
2023-10-27 09:36:56 -04:00
for i in l do
next if ignore.include?(i)
if /\.s[ac]ss$/.match?(i)
print i
print ' ' unless i==l.last
end
end
2023-02-11 09:08:06 -05:00
when "dir"
2023-10-27 09:36:56 -04:00
for i in l do
next if ignore.include?(i)
if File.directory?(i)
print i
print ' ' unless i==l.last
end
end
2023-02-11 09:08:06 -05:00
when "rest"
2023-10-27 09:36:56 -04:00
for i in l do
next if ignore.include?(i)
2023-10-27 09:56:04 -04:00
unless /\.(s[ac]ss|txti|org|md|html)$/.match?(i) or File.directory?(i)
2023-10-27 09:36:56 -04:00
print i
print ' ' unless i==l.last
end
end
2023-02-11 09:08:06 -05:00
else
2023-02-10 14:02:43 -05:00
end