0
gem/cli가 하이 라인을 사용하고 있고 자신의 명령을 설정할 수 있는지 궁금 해서요. '도움').Ruby highline gem : 스크립트/앱 기간 동안 명령을 할당하는 방법이 있습니까
require 'rubygems'
require 'highline/import'
say("\nThis is the new mode (default)...")
choose do |menu|
menu.prompt = "Please choose your favorite programming language? "
menu.choice :ruby do say("Good choice!") end
menu.choices(:python, :perl) do say("Not from around here, are you?") end
end
say("\nThis is letter indexing...")
choose do |menu|
menu.index = :letter
menu.index_suffix = ") "
menu.prompt = "Please choose your favorite programming language? "
menu.choice :ruby do say("Good choice!") end
menu.choices(:python, :perl) do say("Not from around here, are you?") end
end
say("\nThis is with a different layout...")
choose do |menu|
menu.layout = :one_line
menu.header = "Languages"
menu.prompt = "Favorite? "
menu.choice :ruby do say("Good choice!") end
menu.choices(:python, :perl) do say("Not from around here, are you?") end
end
감사합니다!
@Felix 잘하면 위의 코드를 사용하면 더 명확 해집니다 :) 위의 경우 실행하면 'help '를 눌러 도움말 메뉴를 표시하십시오. 언제든지 다른 메뉴를 종료하거나 가져 오려면 'quit'또는 'menu'와 같은 다른 명령을 사용하고 싶습니다. – kreek
doh, 죄송합니다. 저장을 누르는 것을 잊어 버렸음에 틀림 없어, 지금 거기에있다. – kreek