Skip to content

Commit

Permalink
doc and files can just be strings too
Browse files Browse the repository at this point in the history
  • Loading branch information
kiwiroy committed Mar 24, 2017
1 parent bac961f commit 75bd3f5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions lib/Applify.pm
Expand Up @@ -174,6 +174,10 @@ The script will not start if a required field is omitted.
Allow the option to hold a list of values. Examples: "@", "4", "1,3".
See L<Getopt::Long/Options-with-multiple-values> for details.
=item * C<class>
Specify the class a "file" or "dir" type option should be instantiated as.
=item * Other
Any other L<Moose> attribute argument may/will be supported in
Expand Down
6 changes: 5 additions & 1 deletion t/file-dir.t
Expand Up @@ -16,18 +16,22 @@ option dir => directory => 'dir', class => 'TestApp::File';
option file => config_file => 'configuration', class => 'TestApp::File';
option file => file_list => 'files to process', n_of => '\@', class => 'TestApp::File';
option file => output => 'output file', default => 'example/output.txt', class => 'TestApp::File';
option file => path_string => 'path as a string only';
option file => failsafe => 'path as a string only - spurious class', class => 'Not::Existing';
option str => check => 'simple';
app {};
HERE

my $script = $app->_script;

{
local @ARGV = ('--directory', '.');
local @ARGV = ('--directory', '.', '--path', 'bin', '--failsafe', '/tmp');
my $app = $script->app;
isa_ok $app->directory, 'TestApp::File', 'directory option';
isa_ok $app->output, 'TestApp::File', 'default';
is $app->output, 'example/output.txt', 'output file default';
is ref($app->path_string), '', 'path is a string not one of those objects';
is ref($app->failsafe), '', 'failsafe is a string not one of those objects';
}

{
Expand Down

0 comments on commit 75bd3f5

Please sign in to comment.