lib/commando/config.rb in tcollier-commando-1.0.0 vs lib/commando/config.rb in tcollier-commando-2.0.0

- old
+ new

@@ -11,19 +11,35 @@ DEFAULT_PROMPT = 'commando> ' DEFAULT_GREETING = 'Welcome to the commando interface. Type "help" to list available commands' attr_accessor :history_file - - attr_writer :prompt, :greeting + attr_writer :prompt, :greeting, :output + def initialize @mapping = {} # Register the default actions - register('help', Commando::Action::Help, 'Print this message') - register('history', Commando::Action::History, 'Print the history of commands') - register('quit', Commando::Action::Quit, 'Exit the program') + register( + 'help', + Commando::Action::Help.new(config: self), + 'Print this message' + ) + register( + 'history', + Commando::Action::History.new(config: self), + 'Print the history of commands' + ) + register( + 'quit', + Commando::Action::Quit.new, + 'Exit the program' + ) + end + + def output + @output || $stdout end def prompt @prompt || DEFAULT_PROMPT end