Commit graph

1185 commits

Author SHA1 Message Date
mark_story
02f42f3454 Making colouring wrap lines. 2010-10-16 00:04:58 -04:00
mark_story
46dcf8b036 Fixing formatting on generated help in ConsoleOptionParser.
Updating tests.
Making Shell::wrapText a simple wrapper for String::wrap()
2010-10-15 23:09:28 -04:00
mark_story
5f90ac2b45 Adding width wrapping to the generated help. Should help with having content that is too long. 2010-10-14 23:21:56 -04:00
mark_story
0492a188ed Adding Shell::wrapText() to extend String methods, with indenting which can be useful in shell output. 2010-10-14 22:58:23 -04:00
mark_story
b8467164f8 Making ConsoleOutput work correctly when multiple identical tags are used. 2010-10-14 22:16:42 -04:00
mark_story
0428320c78 Adding verbose/quiet flags back to testsuite shell. 2010-10-14 22:15:01 -04:00
mark_story
124a910830 Adding documentation for output levels. 2010-10-13 23:44:50 -04:00
mark_story
4be57a2ea5 Adding output levels to Shell
Adding tests for output levels.
2010-10-13 23:40:45 -04:00
mark_story
c6ef589139 Adding filter option to the testsuite, seems I forgot it. 2010-10-13 23:40:14 -04:00
mark_story
037bc6cb2f Changing how arguments are shown in help output. 2010-10-13 23:18:28 -04:00
mark_story
81d61a66c8 Re-formatting code and removing old help method. 2010-10-13 23:18:27 -04:00
mark_story
03688bc2ff Adding an option parser to controller task.
Converting the public and admin positional arguments into switches.
Updating the task and test cases to reflect the switches changes.
2010-10-13 23:18:27 -04:00
mark_story
5fd85c1150 Adding a very basic option parser to DbConfigTask. 2010-10-13 23:18:27 -04:00
mark_story
6b6d9e9b30 Adding option parser to model task.
Adding omitted options to view task.
2010-10-13 23:18:27 -04:00
mark_story
4985572f9b Adding option parser to the project task. 2010-10-13 23:18:27 -04:00
mark_story
50139b153c Adding OptionParser to view task.
Adding epilog information about interactive mode to view and fixture tasks.
2010-10-13 23:18:27 -04:00
mark_story
d3e4cedf12 Updating test task to use the option parser.
Removing dead help method.
2010-10-13 23:18:27 -04:00
mark_story
52c1c71e4a Updating fixture task to use the OptionParser
Fixing failing tests caused by changing tasks to lazy loading.
2010-10-13 23:18:27 -04:00
mark_story
10090696a0 Making boolean switches behave.
Boolean switches always show up in the parsed options.  When left undefined they insert a false, and when included they insert a true.  This makes working with them require less checks.
2010-10-13 23:18:26 -04:00
mark_story
b328276289 Adding default values into the parsed output.
This makes it so options with default values are always part of the parsed options regardless of whether or not they were included.  This will allow shells to include less logic checking for existence of parameters.
2010-10-13 23:18:26 -04:00
mark_story
3585620470 Adding a ghetto option parser to the testsuite shell. Still need to add in all the options from phpunit, and the other cake options. 2010-10-13 23:18:26 -04:00
mark_story
2af684cbec Fixing issue where exceptions for missing required arguments would be raised when trying to get help. 2010-10-13 23:18:26 -04:00
mark_story
43646b9372 Updating AclShell to use new formatting and removing methods that are no longer needed. 2010-10-13 23:18:26 -04:00
mark_story
0fd8d2b8e4 Adding addSubcommands, and support for subcommands to buildFromArray.
This makes the API consistent across all the elements of ConsoleOptionParser.
2010-10-13 23:18:26 -04:00
mark_story
577603fbd9 Adding documentation, and improving error messages. 2010-10-13 23:18:26 -04:00
mark_story
c3750d1108 Updating AclShell to use features of ConsoleOptionParser. 2010-10-13 23:18:26 -04:00
mark_story
99407e788f Fixing issue where choices would not be correctly validated. 2010-10-13 23:18:26 -04:00
mark_story
8c990a9e08 Fixing failing tests caused by API changes. 2010-10-13 23:18:26 -04:00
mark_story
9540f9aeff Removing dead help method. 2010-10-13 23:18:25 -04:00
mark_story
970a6c8d79 Adding the ability for parse() to use a subcommand parser.
Adding text on how to get help on subcommands.
2010-10-13 23:18:25 -04:00
mark_story
1cf2613a8d Starting to convert bake to use option parsers. 2010-10-13 23:18:25 -04:00
mark_story
822aeb3883 Reformatting help text. 2010-10-13 23:18:25 -04:00
mark_story
ae04ae6e8a Removing implode(), as its done in the OptionParser now. 2010-10-13 23:18:25 -04:00
mark_story
b5630a5e30 Making description() and epilog() accept arrays. 2010-10-13 23:18:25 -04:00
mark_story
412864c510 Porting AclShell help to use the OptionParser. 2010-10-13 23:18:25 -04:00
mark_story
7a31eb41e9 Adding ability to define a subcommand parser as an array.
This makes defining subcommands a bit easier as you don't have to build a pile of objects first.
2010-10-13 23:18:25 -04:00
mark_story
1fec75e6ee Adding omitted __() 2010-10-13 23:18:25 -04:00
mark_story
ef027f6d0e Adding choices to usage and generated help text. 2010-10-13 23:18:25 -04:00
mark_story
b398877887 Adding missing default value. 2010-10-13 23:18:25 -04:00
mark_story
ed0476861e Adding documentation for choices options. 2010-10-13 23:18:24 -04:00
mark_story
4e91012144 Adding validation for positional arguments.
You can use choices option to give a list of valid values that an argument can have.
2010-10-13 23:18:24 -04:00
mark_story
8ee158226a Changing error message. 2010-10-13 23:18:24 -04:00
mark_story
56292b658c Adding option value validation to ConsoleOptionParser. 2010-10-13 23:18:24 -04:00
mark_story
8b46645f6a Making properties protected. 2010-10-13 23:18:24 -04:00
mark_story
49006b2bbb Adding accessor method. 2010-10-13 23:18:24 -04:00
mark_story
dc9a05d49c Extracting subcommand as a separate object.
This allows the internals of ConsoleOptionParser to be more uniform and consistent.
2010-10-13 23:18:24 -04:00
mark_story
8261581b3b Pulling out some duplicated code into methods. 2010-10-13 23:18:24 -04:00
mark_story
5e8222ef39 Pulling out classes into separate files. 2010-10-13 23:18:24 -04:00
mark_story
2774493577 Refactoring arguments into a separate object. 2010-10-13 23:18:24 -04:00
mark_story
12fba88528 Refactoring options into a separate object.
There are changes that need to be made for boolean and options with choices, and having a separate object will make them much easier to do.
2010-10-13 23:18:24 -04:00
mark_story
ad367fed9a Adding addOptions and addArguments as convience methods for adding multiple options/arguments. 2010-10-13 23:18:24 -04:00
mark_story
72e1a96a9a Renaming a Shell::_getOptionParser -> getOptionParser
Made the method public so subparser help would be easy to wire up. Moving help generation above task invocation so it always displays.
2010-10-13 23:18:23 -04:00
mark_story
ab794b300e Adding support for help generating help for subcommands.
Adding tests for subcommand help generation.
2010-10-13 23:18:23 -04:00
mark_story
3be24d0b0b Adding subcommand docs for i18n shell.
Adding execute checks to shell, this is a temporary fix that stops extra clears being done.
2010-10-13 23:18:23 -04:00
mark_story
fe7c7a1b12 Adding some colour to Shell::createFile()
Removing the now dead Shell::help().  The OptionParser approach provides much better help information than this method did.
2010-10-13 23:18:23 -04:00
mark_story
56339e05f3 Adding subcommand to help output.
Subcommands can be shell methods or tasks.  Both should support additional parsers.  Which is not complete yet.
2010-10-13 23:18:23 -04:00
mark_story
278f699fda Updating extract task. 2010-10-13 23:18:23 -04:00
mark_story
41b8affa82 Updating i18n shell to start using new OptionParser class.
Removing more dead attributes from Shell. Making Shell::$name the name used to invoke the shell, not the classname.  This makes it similar to other objects with names.
2010-10-13 23:18:23 -04:00
mark_story
2a2428a694 Updating ApiShell to use ConsoleOptionParser correctly.
Removing old help method.
2010-10-13 23:18:23 -04:00
mark_story
c0d15a420c Changing name of parser attribute. 2010-10-13 23:18:23 -04:00
mark_story
f1ee46749b Fixing failing tests in Schema shell. 2010-10-13 23:18:23 -04:00
mark_story
193721a0eb Fixing notice errors in ShellDispatcher
Removing ShellDispatcher tests that are now inside Shell.
Changing exception type to match the one used in ShellDispatcher.
2010-10-13 23:18:23 -04:00
mark_story
e70089891d Adding some more array_unshift. These fix issues where tasks would receive their name in the argv which is not correct. 2010-10-13 23:18:22 -04:00
mark_story
79d1739778 Adding tests for task methods in runCommand.
Moving startup() call to the dispatcher so nested runCommand calls don't double output the startup content.
2010-10-13 23:18:22 -04:00
mark_story
3d351e7760 Dramatically changing how ShellDispatcher and Shell interact.
Shell::runCommand is now responsible for delegating out to tasks and correctly checking methods to run.  ShellDispatcher no longer parses parameters and instead only pulls out the path information that it needs to setup the environment.
2010-10-13 23:18:22 -04:00
mark_story
cd18c8214c Adding Shell::hasMethod and tests for it. 2010-10-13 23:18:22 -04:00
mark_story
18c5a62445 Removing a dead test and adding tests for hasTask 2010-10-13 23:18:22 -04:00
mark_story
830238c2dd Removing $this->AppModel from shells.
Having a partially constructed model in the shell is not useful, and
gives the impression that it will work correctly. Which it doesn't.
2010-10-13 23:18:22 -04:00
mark_story
fbcc9c1fc1 Making Tasks lazy load.
This allows task initialization to be moved out of ShellDispatcher where it does not belong, as tasks are similar to components.  Updating parts of TaskCollection, as the Dispatcher is still required to be passed around.
2010-10-13 23:18:22 -04:00
mark_story
4d199cf8a8 Removing Shell::_loadDbConfig() and Shell::$DbConfig
They did not make sense in Shell as no other core shells even use these
properties/methods.
2010-10-13 23:18:22 -04:00
mark_story
0d522f3bd4 Changing ShellDispatcher to use --help and -h like the option parser does. 2010-10-13 23:18:22 -04:00
mark_story
7f5b5c4fbd Adding exception for unknown option usage. 2010-10-13 23:18:21 -04:00
mark_story
d3c95bc2c4 Adding epilog and description to the generate help. 2010-10-13 23:18:21 -04:00
mark_story
501e63e45d Adding argument help generation in the long help and usage string.
Fixing output of option help, formatting was calculated in 2 places.
2010-10-13 23:18:21 -04:00
mark_story
09adc38b6c Doing some fixes as the longest option + a short would cause incorrect formatting. 2010-10-13 23:18:21 -04:00
mark_story
733394d584 Adding usage generation for options. 2010-10-13 23:18:21 -04:00
mark_story
cea6cef727 Adding smart defaults for verbose, quiet, and help options.
Adding help formatting for options.
2010-10-13 23:18:21 -04:00
mark_story
a3259743f7 Making error output style have an underline.
Adding a comment style which has blue text.
2010-10-13 23:18:21 -04:00
mark_story
f5ad54e97e Adding required argument checking. 2010-10-13 23:18:21 -04:00
mark_story
505e59ac66 Adding support for boolean options. 2010-10-13 23:18:21 -04:00
mark_story
3e402e2dfb Adding support for positional arguments.
Adding tests and support for positional arguments. Renaming description
key to help as its shorter.
2010-10-13 23:18:21 -04:00
mark_story
6f1dae208c Adding method skeleton 2010-10-13 23:18:21 -04:00
mark_story
b392f300ba Adding docs about how options work. 2010-10-13 23:18:20 -04:00
mark_story
3b9921a390 Adding support for -abc style combination of short options.
Renaming shortcut to short as its shorter :)
2010-10-13 23:18:20 -04:00
mark_story
01a7fc70b7 Removing dead code. 2010-10-13 23:18:20 -04:00
mark_story
07bda824f0 Adding test for parsing multiple options. 2010-10-13 23:18:20 -04:00
mark_story
2c2c9a38d2 Removing required, and type from option flag as they didn't really make sense to include at this point. Adding support for --foo=bar type parameters. 2010-10-13 23:18:20 -04:00
mark_story
7b1b835bc1 Adding very basic implementation for parsing long and short options. 2010-10-13 23:18:20 -04:00
mark_story
d5d9adb92b Starting to implement options and option parsing. 2010-10-13 23:18:20 -04:00
mark_story
694537933e Adding description() and epilog() to ConsoleOptionParser. Starting to build out addOption. 2010-10-13 23:18:20 -04:00
mark_story
d914c0aaea Adding ConsoleOptionParser and its test. 2010-10-13 23:18:20 -04:00
mark_story
73ad3043a2 Fixing more console tests to use new internals.
Making TaskCollection pass the stdout, stdin, stderr to Tasks they create.  This allows for more flexible dependency injection and makes testing easier.
2010-10-13 23:18:20 -04:00
mark_story
7921ef1282 Fixing Shell tests to use ConsoleInput. 2010-10-13 23:18:19 -04:00
mark_story
e816a49a6f Moving ShellDispatcher::getInput() into Shell as a protected method. 2010-10-13 23:18:19 -04:00
mark_story
67f03afa02 Moving ConsoleInput to the correct directory. 2010-10-13 23:18:19 -04:00
mark_story
cd8d29ef1c Removing conceal, because its a stupid option. 2010-10-13 23:18:19 -04:00
mark_story
131433739e Removing dead test stubs and test methods.
Moving clear() into Shell, it should be a shell method.
Changing shell methods to use ConsoleOutput objects, instead of methods on Dispatcher.
2010-10-13 23:18:19 -04:00
mark_story
a55098b00b Making TaskCollection require a Shell instead of a ShellDispatcher.
This will help reduce the coupling between ShellDispatcher and other objects.
Since ShellDispatcher never directly uses or interacts with TaskCollection, it doesn't make much sense for it to have one.  Instead shells will either get their own, or be passed one in.
2010-10-13 23:18:19 -04:00
mark_story
b6602f1d0d Converting more stderr() use into exceptions. 2010-10-13 23:18:19 -04:00
mark_story
749e9c19d5 Adding success style.
Adding some additional formatting to the default welcome method.
2010-10-13 23:18:19 -04:00