[Libguestfs] [PATCH libguestfs 1/3] podwrapper: __INCLUDE:file.pod__ and __VERBATIM:file.txt__ in POD files.
Pino Toscano
ptoscano at redhat.com
Wed Nov 27 12:27:21 UTC 2019
On Tuesday, 26 November 2019 19:13:21 CET Richard W.M. Jones wrote:
> +my $path;
> +
> +=item B<--path DIR[:DIR...]>
> +
> +Set the path used for searching for included files (see L</POD FORMAT>
> +above). The current directory is always searched first so you don’t
> +need to add that explicitly.
I believe we can improve the handling of this option, for example
allowing multiple occurrences.
> @@ -642,11 +682,29 @@ if ($text) {
> #print "$progname: wrote $text\n";
> }
>
> +sub find_file
> +{
> + my $input = shift;
> + my $path = shift;
> + local $_;
> +
> + my @path = (".");
> + if ($path) {
> + push (@path, split (/:/, $path))
> + }
This splits the include path every time, while the list of paths does
not change. Most probably we can do the following:
my @paths = ('.');
[...]
GetOptions(
"path=s" => sub {
push @paths, split(/:/, $_[1]);
},
[...]
This way:
- @paths is already there as array
- @paths already includes '.' as first element
- --path can still be a colon-separated list of paths
- --path can be specified multiple times
BTW is the colon-separated value for --path needed? Reading the other
two patches of this series, I see the values are only a single
directory every time. In this case, the proposal above can be
simplified as:
my @paths = ('.');
[...]
GetOptions(
"path=s" => \@paths,
[...]
--
Pino Toscano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20191127/11c24b0f/attachment.sig>
More information about the Libguestfs
mailing list