4

I can change the irb prompt mode with

irb --prompt prompt-mode

I can see what null and simple does, but I can't tell the difference between null and xmp and the difference between default/classic/inf-ruby. Can someone explain to me what these other modes do? It seems pointless to have multiple modes doing the same thing.

4

2 に答える 2

8

Once you read the article cldwalker posted above, you may want to design a custom prompt, here's mine for example:

IRB.conf[:PROMPT][:CUSTOM] = {
  :PROMPT_I => ">> ",
  :PROMPT_S => "%l>> ",
  :PROMPT_C => ".. ",
  :PROMPT_N => ".. ",
  :RETURN => "=> %s\n"
}
IRB.conf[:PROMPT_MODE] = :CUSTOM
IRB.conf[:AUTO_INDENT] = true
于 2010-03-18T08:17:39.550 に答える
5

これらの質問に対する答えは、IRB.conf [:PROMPT]にあります。これは、キーが異なるプロンプトであり、値が各プロンプトの構成であるハッシュです。これを読んで、プロンプトの構成を理解してください

nullとxmpの違いは、xmpが矢印でインデントされた結果を表示することです。

$ irb --prompt xmp -f
2**10
    ==>1024

nullは矢印をインデントまたは表示しませんが、次のようになります。

$ irb --prompt null -f
2**10
1024

上記のリンクを読み、プロンプトにはさまざまなモードと構成があることを理解すると、2番目の質問に答えられるはずです。

于 2010-03-18T02:50:31.373 に答える