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
849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 |
# File 'lib/build-tool/commands.rb', line 849 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
842 843 844 845 846 847 |
# File 'lib/build-tool/commands.rb', line 842 def execute( args ) if args.length == 0 return cli end super end |
#fullname ⇒ Object
892 893 894 |
# File 'lib/build-tool/commands.rb', line 892 def fullname nil end |