http://wikipedlla.com/completion_on_assignment_expression
> Hi.
> I'm using rush on cygwin. It seems to work fine and is extremely
> useful. thanks.
> btw, I modified shell.rb as follows because I want path-completion on
> assignment (or any) expression.
> --- shell.rb.orig 2008-02-25 00:40:28.550195200 +0900
> +++ shell.rb 2008-02-25 00:52:41.213713600 +0900
> @@ -90,7 +90,10 @@
> end
> def path_parts(input) # :nodoc:
> - input.match(/^(.+)\[(['"])([^\]]+)$/).to_a.slice(1, 3) rescue
> [ nil, nil, nil ]
> + match = input.match(/(\w+)\[(['"])([^\]]+)$/)
> + match.to_a.slice(1, 3).push(match.pre_match)
> + rescue
> + [ nil, nil, nil, nil ]
> end
> # Try to do tab completion on dir square brackets accessors.
> @@ -103,7 +106,7 @@
> # It does work remotely, though, which is pretty sweet.
> def completion_proc
> proc do |input|
> - possible_var, quote, partial_path = path_parts(input)
> + possible_var, quote, partial_path, pre = path_parts(input)
> if possible_var and possible_var.match(/^[a-z0-9_]+$/)
> full_path = eval("#{possible_var}.full_path", @pure_binding)
> rescue nil
> box = eval("#{possible_var}.box", @pure_binding) rescue nil
> @@ -112,7 +115,7 @@
> return dir.entries.select do |e|
> e.name.match(/^#{partial_path}/)
> end.map do |e|
> - possible_var + '[' + quote +
e.name + (e.dir? ? "/" : "")
> + (pre || '') + possible_var + '[' + quote +
e.name + (e.dir? ?
> "/" : "")
> end
> end
> end
>