| 1 | package Sah::Schema::filename::exists::default_only_file_in_curdir; | ||
| 2 | |||
| 3 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | 1 | our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY | |
| 6 | 1 | our $DATE = '2024-02-16'; # DATE | |
| 7 | 1 | our $DIST = 'Sah-SchemaBundle-Path'; # DIST | |
| 8 | 1 | our $VERSION = '0.031'; # VERSION | |
| 9 | |||
| 10 | 1 | our $schema = ["filename::exists" => { | |
| 11 | summary => 'File name, must exist on the filesystem, defaults to only file in current directory (if there is one)', | ||
| 12 | description => <<'MARKDOWN', | ||
| 13 | |||
| 14 | This is like the `filename::exists` schema but with a default value of "only | ||
| 15 | file in the current directory". That is, if the current directory has a single | ||
| 16 | plain file and nothing else. | ||
| 17 | |||
| 18 | Note: be careful when using this schema for actions that are destructive, | ||
| 19 | because a user can perform those actions without giving an argument (e.g. in a | ||
| 20 | `delete-file` script). It is safer to use this schema when performing a | ||
| 21 | non-destructive action (e.g. `checksum`) and/or operate in dry-run mode by | ||
| 22 | default. | ||
| 23 | |||
| 24 | MARKDOWN | ||
| 25 | 'x.perl.default_value_rules' => ['Path::only_file_in_curdir'], | ||
| 26 | }]; | ||
| 27 | |||
| 28 | 1 | 1; | |
| 29 | # ABSTRACT: File name, must exist on the filesystem, defaults to only file in current directory (if there is one) | ||
| 30 | |||
| 31 | __END__ | ||