Skip to content

Instantly share code, notes, and snippets.

@jugyo
Created October 31, 2009 07:23
Show Gist options
  • Save jugyo/222968 to your computer and use it in GitHub Desktop.
Save jugyo/222968 to your computer and use it in GitHub Desktop.
module Termtter::Client
register_command(
:async,
:alias => :a,
:help => ['async COMMAND', 'asynchronously execute the command'],
:completion => lambda {|cmd, arg|
commands.map{|name, command| command.complement(arg)}.
flatten.
compact.
map{|i| "#{cmd} #{i}"}
},
:exec => lambda {|arg|
@task_manager.invoke_later do
begin
call_commands(arg)
rescue Exception => e
handle_error(e)
end
Readline.refresh_line
end
}
)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment