Sha256: 9d4d09ff7e8ca31c36815c463422645dd141a4f5f68523e276061235944564ce

Contents?: true

Size: 560 Bytes

Versions: 3

Compression:

Stored size: 560 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

3 entries across 3 versions & 1 rubygems

Version Path
oct-0.3.3 lib/oct/oct.rb
oct-0.3.2 lib/oct/oct.rb
oct-0.3.1 lib/oct/oct.rb