mirror of
https://github.com/clap-rs/clap
synced 2024-12-13 22:32:33 +00:00
8cb9a7d486
This commit introduces a new feature called `"regex"`. It adds a new function `validator_regex` to `Arg` and was inspired by the discussion in #1968. The name `validator_regex` was chosen instead of `regex_validator` to make sure that the developer keeps in mind that there may only be a single `Validator` on an `Arg`. The feature can be used with YAML files, however there is no proper pattern in `clap_app!` (yet).
15 lines
416 B
YAML
15 lines
416 B
YAML
name: clapregextest
|
|
version: "1.0"
|
|
about: tests clap regex functionality
|
|
author: Benjamin Kästner <benjamin.kaestner@gmail.com>
|
|
settings:
|
|
- ArgRequiredElseHelp
|
|
args:
|
|
- help:
|
|
short: h
|
|
long: help
|
|
about: prints help with a nonstandard description
|
|
- filter:
|
|
index: 1
|
|
validator_regex: ["^*\\.[a-z]+$", expected extension pattern]
|
|
about: file extension pattern
|