12 Commits

Author SHA1 Message Date
Mitchell Hashimoto
b23dda54b8 Move command base class to a plugin component 2012-06-26 16:18:02 -07:00
Mitchell Hashimoto
1a6ae81aa9 Require what to be notified for with block and Subprocess.execute
There was an issue before where the stdin buffer would always have space
so it would always yield that block and Ruby would spin at 100%. Now we
require all callers to say what they want to listen for. This drops
CPU down to almost nothing.

See GH-832
2012-06-01 17:02:12 +02:00
Mitchell Hashimoto
903fd3acdc Easy operations API local now echoes stdout/stderr 2012-06-01 16:38:40 +02:00
Mitchell Hashimoto
ca6d49bc94 Easy operations run and sudo now echo stdout/stderr 2012-06-01 16:33:41 +02:00
Mitchell Hashimoto
f133f39bcc Add comment to explain unclear code 2012-06-01 16:08:41 +02:00
Mitchell Hashimoto
fd9ad904fe Easy commands now take a target VM name
It is assumed to be the first arg, as long as the first arg doesn't
begin as a flag "-foo"
2012-06-01 15:59:05 +02:00
Mitchell Hashimoto
83917a6bb0 Added arg and arg_extra API to easy commands
Easy commands can now easily get arguments from the command line.

Using `arg`, you can get named arguments on the command line, such as
"--foo" or "-f"

With `arg_extra`, you can get any remaining arguments after a "--"
on the command line, which is a common pattern used to grab longer
parameters.
2012-06-01 15:57:55 +02:00
Mitchell Hashimoto
9cb53860c2 New easy command APIs: argv, info, error, success
Some new APIs were added to the easy command operations. `info`,
`error`, and `success` are simple ways to output messages to the UI
without resorting to "puts" in Ruby, since the Vagrant UI object is the
idiomatic way to do communication with the world.

Additionally, `argv` was added which gives commands access to the
command-line arguments that are remaining that does not include the
vagrant binary or subcommand.

Also, behavior was changed: Previously, easy commands would run for
every target VM. Now, it is only run once with the primary VM. In the
next commit, I plan on adding a new flag that signifies an easy command
is meant to work with a named VM.
2012-06-01 14:55:08 +02:00
Mitchell Hashimoto
0d6248394c Tests for the Easy command base 2012-05-06 10:01:50 -07:00
Mitchell Hashimoto
dc4f6e1939 Allow creating multiple easy commands 2012-05-06 09:54:23 -07:00
Ryan LeCompte
2355a4b9a6 fix support for multiple unique easy commands 2012-05-06 01:47:43 -07:00
Mitchell Hashimoto
31ac7271aa Rename EasyCommand namespace to Easy 2012-05-05 22:16:13 -07:00