diff options
author | ayumin <ayumin@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-05-08 18:46:16 +0000 |
---|---|---|
committer | ayumin <ayumin@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-05-08 18:46:16 +0000 |
commit | 8b6a874a59e6fefdaa6bb65e8095eb498f8d551a (patch) | |
tree | b89a4e264349cb0ec5f6a7f6b183a4579a9a4c07 /lib | |
parent | 529461dff73afcf1e0810df54d6ad0479d5f5d10 (diff) | |
download | ruby-8b6a874a59e6fefdaa6bb65e8095eb498f8d551a.tar.gz |
* lib/shell.rb: add documentation in lib/shell.rb
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45881 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r-- | lib/shell.rb | 41 |
1 files changed, 38 insertions, 3 deletions
diff --git a/lib/shell.rb b/lib/shell.rb index 928073e144..2204e27cc6 100644 --- a/lib/shell.rb +++ b/lib/shell.rb @@ -355,7 +355,22 @@ class Shell @process_controller.kill_job(sig, command) end - # Convenience method for Shell::CommandProcessor.def_system_command + # call-seq: + # def_system_command(command, path = command) + # + # Convenience method for Shell::CommandProcessor.def_system_command. + # Defines an instance method which will execute the given shell command. + # If the executable is not in Shell.default_system_path, you must + # supply the path to it. + # + # Shell.def_system_command('hostname') + # Shell.new.hostname # => localhost + # + # # How to use an executable that's not in the default path + # + # Shell.def_system_command('run_my_program', "~/hello") + # Shell.new.run_my_program # prints "Hello from a C program!" + # def Shell.def_system_command(command, path = command) CommandProcessor.def_system_command(command, path) end @@ -365,7 +380,17 @@ class Shell CommandProcessor.undef_system_command(command) end - # Convenience method for Shell::CommandProcessor.alias_command + # call-seq: + # alias_command(alias, command, *opts, &block) + # + # Convenience method for Shell::CommandProcessor.alias_command. + # Defines an instance method which will execute a command under + # an alternative name. + # + # Shell.def_system_command('date') + # Shell.alias_command('date_in_utc', 'date', '-u') + # Shell.new.date_in_utc # => Sat Jan 25 16:59:57 UTC 2014 + # def Shell.alias_command(ali, command, *opts, &block) CommandProcessor.alias_command(ali, command, *opts, &block) end @@ -375,7 +400,17 @@ class Shell CommandProcessor.unalias_command(ali) end - # Convenience method for Shell::CommandProcessor.install_system_commands + # call-seq: + # install_system_commands(pre = "sys_") + # + # Convenience method for Shell::CommandProcessor.install_system_commands. + # Defines instance methods representing all the executable files found in + # Shell.default_system_path, with the given prefix prepended to their + # names. + # + # Shell.install_system_commands + # Shell.new.sys_echo("hello") # => hello + # def Shell.install_system_commands(pre = "sys_") CommandProcessor.install_system_commands(pre) end |