Sha256: c246042c7955e7d0d8fcefa03681c578afc61d01638f596eec8ad5735d148b70

Contents?: true

Size: 569 Bytes

Versions: 2

Compression:

Stored size: 569 Bytes

Contents

module Oct

  class FileStat

    # print octal file listing
    #
    # @param [Array] files files to be listed
    def mode(files, options={})
      puts "oct mode files: #{files.inspect}".cyan if options[: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

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
oct-0.2.0 lib/oct/oct.rb
oct-0.1.0 lib/oct/oct.rb