Method: Shell::CommandProcessor.install_builtin_commands

Defined in:
lib/shell/command-processor.rb

.install_builtin_commandsObject

Delegates File methods into Shell, including the following commands:

  • Shell#atime(file)

  • Shell#basename(file, *opt)

  • Shell#chmod(mode, *files)

  • Shell#chown(owner, group, *file)

  • Shell#ctime(file)

  • Shell#delete(*file)

  • Shell#dirname(file)

  • Shell#ftype(file)

  • Shell#join(*file)

  • Shell#link(file_from, file_to)

  • Shell#lstat(file)

  • Shell#mtime(file)

  • Shell#readlink(file)

  • Shell#rename(file_from, file_to)

  • Shell#split(file)

  • Shell#stat(file)

  • Shell#symlink(file_from, file_to)

  • Shell#truncate(file, length)

  • Shell#utime(atime, mtime, *file)



634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
# File 'lib/shell/command-processor.rb', line 634

def self.install_builtin_commands
  # method related File.
  # (exclude open/foreach/unlink)
  normal_delegation_file_methods = [
    ["atime", ["FILENAME"]],
    ["basename", ["fn", "*opts"]],
    ["chmod", ["mode", "*FILENAMES"]],
    ["chown", ["owner", "group", "*FILENAME"]],
    ["ctime", ["FILENAMES"]],
    ["delete", ["*FILENAMES"]],
    ["dirname", ["FILENAME"]],
    ["ftype", ["FILENAME"]],
    ["join", ["*items"]],
    ["link", ["FILENAME_O", "FILENAME_N"]],
    ["lstat", ["FILENAME"]],
    ["mtime", ["FILENAME"]],
    ["readlink", ["FILENAME"]],
    ["rename", ["FILENAME_FROM", "FILENAME_TO"]],
    ["split", ["pathname"]],
    ["stat", ["FILENAME"]],
    ["symlink", ["FILENAME_O", "FILENAME_N"]],
    ["truncate", ["FILENAME", "length"]],
    ["utime", ["atime", "mtime", "*FILENAMES"]]]

  def_builtin_commands(File, normal_delegation_file_methods)
  alias_method :rm, :delete

  # method related FileTest
  def_builtin_commands(FileTest,
               FileTest.singleton_methods(false).collect{|m| [m, ["FILENAME"]]})

end