@@ -284,6 +284,39 @@ sub run_action_cmd {
284
284
$self -> run_action_exec($cmd , @args );
285
285
}
286
286
287
+ sub run_action_dev {
288
+ my ($self ) = @_ ;
289
+ $self -> ensure_layout_config_dir;
290
+
291
+ unless (-d (my $dir = $self -> layout_dir(' dev' ))) {
292
+ mkdir ($dir ) or die " Couldn't make script dir ${dir} : $! " ;
293
+ my $file = $self -> layout_file(' dev' , ' find' );
294
+ open my $wfh , ' >' , $file or die " Couldn't open ${file} : $! " ;
295
+ print $wfh <<'EOF' ;
296
+ #!perl
297
+
298
+ use feature 'say';
299
+ use File::Basename 'basename';
300
+ use File::Spec::Functions 'catfile';
301
+
302
+ my $in = $ARGV[0] || '.*';
303
+
304
+ map say(basename($_)), grep /$in/, map glob(catfile($_, '*')), grep -d, qw(
305
+ ./bin
306
+ ./dev
307
+ ./local/bin
308
+ ./script
309
+ ./scripts
310
+ );
311
+ EOF
312
+ stderr <<END ;
313
+ .plx script directory [dev] initialised with script [find]:
314
+
315
+ plx find <arg>
316
+ END
317
+ }
318
+ }
319
+
287
320
sub run_action_perl {
288
321
my ($self , @call ) = @_ ;
289
322
$self -> ensure_layout_config_dir;
@@ -621,6 +654,7 @@ a modified C<--cpanm> action that uses an inline C<App::cpanminus>.
621
654
plx --init <perl> # Initialize layout config for .
622
655
plx --base # Show layout base dir
623
656
plx --base <base> <action> <args> # Run action with specified base dir
657
+ plx --dev # Initialize (dev) script dir
624
658
625
659
plx --perl # Show layout perl binary
626
660
plx --libs # Show layout $PERL5LIB entries
@@ -753,6 +787,19 @@ Without arguments, sugar for C<--config perl>.
753
787
Otherwise, sets up the layout's environment variables and C<exec > s the
754
788
layout's perl with the given options and arguments.
755
789
790
+ =head2 --dev
791
+
792
+ plx --dev
793
+
794
+ Initializes the ./dev script directory with ./dv/find.
795
+
796
+ There are various common directories which are searched in order to resolve
797
+ script execution including the C<dev > directory. You can add your own scripts
798
+ to any of these directories and have C<plx > find and execute them. Unless the
799
+ C<dev > directory already exists in the current working directory, this command
800
+ creates that directory and seeds it with a C<find > script that helps you see
801
+ what scripts are available across these directories.
802
+
756
803
=head2 --cmd
757
804
758
805
plx --cmd <cmd> <args> # DWIM command:
0 commit comments