Class: BuildTool::Commands::Shell
- Inherits:
-
SubCommands
- Object
- Base
- SubCommands
- BuildTool::Commands::Shell
- Defined in:
- lib/build-tool/commands.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from SubCommands
#add_command, #complete_arguments, #complete_command, #do_complete_1_8, #do_complete_1_9, #get_command, #initialize, #load_commands, #show_help
Methods inherited from Base
#<=>, #applicable?, #cleanup_after_vcs_access, #complete, #complete_arguments, #complete_readline_1_8, #complete_readline_1_9, #configuration, #do_complete_1_8, #do_complete_1_9, #do_execute, #each_option, #initialize, #initialize_options, #log?, #say, #setup_command, #show_help, #skip_command, #summarize, #teardown_command, #usage
Methods included from HelpText
#cmdalias, #description, included, #long_description, #name
Constructor Details
This class inherits a constructor from BuildTool::Commands::SubCommands
Instance Method Details
#cli ⇒ Object
815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 |
# File 'lib/build-tool/commands.rb', line 815 def cli require 'readline' Readline.completion_proc = method(:complete) if !Readline.respond_to? "line_buffer" # 1.8 :( Readline.completer_word_break_characters = "\x00" end while true begin line = Readline.readline('> ', true) return 0 if line.nil? # Ignore whitespace lines next if Shellwords.shellwords( line ).length == 0 # Remove duplicate or empty lines from history if line =~ /^\s*$/ or Readline::HISTORY.to_a[-2] == line Readline::HISTORY.pop end # Split the line like bash would do it execute Shellwords.shellwords( line ) rescue BuildTool::Error => e logger.error e. logger.verbose e.backtrace.join("\n") rescue StandardError => e logger.error e. logger.error e.backtrace.join("\n") rescue Interrupt => e say "Use CTRL-D for exit!" end end return 0 end |
#execute(args) ⇒ Object
808 809 810 811 812 813 |
# File 'lib/build-tool/commands.rb', line 808 def execute( args ) if args.length == 0 return cli end super end |
#fullname ⇒ Object
858 859 860 |
# File 'lib/build-tool/commands.rb', line 858 def fullname nil end |