I'm all for making it a class. I feel like we under use classes in MSF and one of the byproducts is code that is not change resistant, not to mention not very OO. I will take this route. There aren't many callers and most don't do anything with the return value anyways

-Josh

On Jul 17, 2013, at 9:08, Luke Imhoff <notifications@github.com> wrote:

> In lib/rex/ui/text/dispatcher_shell.rb:
> 
> > +	# @param separator [String] The separator used to delimit the data, defaults to ;
> > +	# @param quote_char [String] The quoting escape character(1 char only) used to escape +separator+, defaults to "
> > +	# @return [Boolean] Returns true if all commands succeeded, otherwise false
> > +	def run_multiple(line, separator = ';', quote_char = '"')
> > +		lines = []
> > +		# handle a multi-command line (lines with cmd;other_cmd)
> > +		opts = {:col_sep => separator, :quote_char => quote_char}
> > +		lines = parse_multi_line(line, opts)
> > +		all_commands_found = true
> > +		if lines.empty?
> > +			print_error "No parsable commands were found."
> > +			return false
> > +		end
> > +		lines.each do |l|
> > +			# run each single command
> > +			all_commands_found = false if not run_single(l)
> I think it's better to find all the current callers of this command (I don't know if you're using Rubymine, but its Find Usage command is useful for this. Use w/e is equivalent for your development environment) and then have the return value be an instance of a Class like CommandSequence and it contains multiple Commands that include the original command line and the return status code. (Probably want some way to indicate if the commands were joined with &&, ||, and ; too). By making them classes, it's easier to document the format in YARD for consumers as YARD doesn't expose a nice way to document a returned Hash format the way it does for with @option for @param. You might even be able to leverage the S expression synax from YARD or the Abstract Syntax Tree from Ruby, but those are both probably too tied to Ruby syntax to work for our commands. Although I recall YARD working for C too, so maybe the S expres sions are generic, but they may be too low-level for documenting commands. You could even have the parse spit out a CommandSequence object and have it have the a run method that then updates it self so that most of run_multiple gets folded into this new CommandSequence class.
> 
> —
> Reply to this email directly or view it on GitHub.