Class: Oct::FileStat
- Inherits:
-
Object
- Object
- Oct::FileStat
- Defined in:
- lib/oct/oct.rb
Instance Method Summary collapse
-
#mode(files, options = {}) ⇒ Object
print octal file listing.
Instance Method Details
#mode(files, options = {}) ⇒ Object
print octal file listing
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/oct/oct.rb', line 8 def mode(files, ={}) puts "oct mode files: #{files.inspect}".cyan if [:verbose] files.sort.each do |file| stat = File.stat(file) printf("%04o ", stat.mode & 07777) if stat.directory? puts file.blue elsif stat.executable? puts file.green elsif stat.symlink? puts file.cyan else puts file end end end |