NAME

Getopt::Pad::Type::Dir - The dir option type

SYNOPSIS

options => {
    'work-dir'  => { type => 'dir', mustExist => 1 },
    'cache-dir' => { type => 'dir', createPathIfMissing => 1 },
},

DESCRIPTION

The type of options and args declared with type => 'dir' or 'directory'. It accepts any path and returns it as given; a leading ~ is not expanded.

  • With mustExist, the path must be an existing directory (-d); a missing path is rejected with directory 'PATH' does not exist, any other existing path with 'PATH' is not a directory.

  • With createPathIfMissing, a missing directory is created with all missing parent directories, for the value that is finally used.

The help output labels the option [Path], and shell completion completes directory names. See "dir" in Getopt::Pad and "Type-specific keys" in Getopt::Pad.

SEE ALSO

Getopt::Pad::Type::File, Getopt::Pad::Type::Path

AUTHOR

davenonymous <perl@davenonymous.com>

COPYRIGHT AND LICENSE

Copyright 2026 davenonymous

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.