我正在阅读从命令行运行ruby并发现:How to run ruby programs on Windows 7?
其中一个答案说
ruby命令的一般形式是:
ruby [ruby options] [程序名] [程序选项]
我尝试在网上寻找这些[红宝石选项]但找不到任何东西。你们有这些红宝石选项列表还是至少有用的链接?
答案 0 :(得分:4)
打开命令提示符并输入ruby -h
,您将获得以下所有内容:
C:\>ruby -h
Usage: ruby [switches] [--] [programfile] [arguments]
-0[octal] specify record separator (\0, if no argument)
-a autosplit mode with -n or -p (splits $_ into $F)
-c check syntax only
-Cdirectory cd to directory, before executing your script
-d set debugging flags (set $DEBUG to true)
-e 'command' one line of script. Several -e's allowed. Omit [programfile]
-Eex[:in] specify the default external and internal character encodings
-Fpattern split() pattern for autosplit (-a)
-i[extension] edit ARGV files in place (make backup if extension supplied)
-Idirectory specify $LOAD_PATH directory (may be used more than once)
-l enable line ending processing
-n assume 'while gets(); ... end' loop around your script
-p assume loop like -n but print line also like sed
-rlibrary require the library, before executing your script
-s enable some switch parsing for switches after script name
-S look for the script using PATH environment variable
-T[level=1] turn on tainting checks
-v print version number, then turn on verbose mode
-w turn warnings on for your script
-W[level=2] set warning level; 0=silence, 1=medium, 2=verbose
-x[directory] strip off text before #!ruby line and perhaps cd to directory
--copyright print the copyright
--version print the version
答案 1 :(得分:1)
Arup的答案已经给出了一些答案,但请参阅here了解更多内容。也就是说,以下是Arup答案中缺少的那些:
-h Displays an overview of command-line options.
-K [ kcode] Specifies the multibyte character set code (e or E for EUC (extended Unix code); s or S for SJIS (Shift-JIS); u or U for UTF-8; and a, A, n, or N for ASCII).
-X dir Changes directory before executing (equivalent to -C).
-y Enables parser debug mode.
--debug Enables debug mode (equivalent to -d).
--help Displays an overview of command-line options (equivalent to -h).
--verbose Enables verbose mode (equivalent to -v). Sets $VERBOSE to true
--yydebug Enables parser debug mode (equivalent to -y).
答案 2 :(得分:0)
以下是Ruby的命令行选项:
Usage: ruby [switches] [--] [programfile] [arguments]
-0[octal] specify record separator (\0, if no argument)
-a autosplit mode with -n or -p (splits $_ into $F)
-c check syntax only
-Cdirectory cd to directory, before executing your script
-d set debugging flags (set $DEBUG to true)
-e 'command' one line of script. Several -e's allowed. Omit [programfile]
-Eex[:in] specify the default external and internal character encodings
-Fpattern split() pattern for autosplit (-a)
-i[extension] edit ARGV files in place (make backup if extension supplied)
-Idirectory specify $LOAD_PATH directory (may be used more than once)
-l enable line ending processing
-n assume 'while gets(); ... end' loop around your script
-p assume loop like -n but print line also like sed
-rlibrary require the library, before executing your script
-s enable some switch parsing for switches after script name
-S look for the script using PATH environment variable
-T[level=1] turn on tainting checks
-v print version number, then turn on verbose mode
-w turn warnings on for your script
-W[level=2] set warning level; 0=silence, 1=medium, 2=verbose
-x[directory] strip off text before #!ruby line and perhaps cd to directory
--copyright print the copyright
--version print the version