> Any suggestions? Do you see a general problem with my approach?

Not sure I understand your approach. If you're looking to make a complex 
shell, you may want to consider ripl, http://github.com/cldwalker/ripl. 
It can handle custom autocompletion via bond, 
http://github.com/cldwalker/bond

Gabriel

-- 
Posted via http://www.ruby-forum.com/.