File: validators.md

package info (click to toggle)
knack 0.13.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 696 kB
  • sloc: python: 6,261; sh: 8; makefile: 4
file content (20 lines) | stat: -rw-r--r-- 806 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Validators
==========

Validators allow you to validate or transform command arguments just before execution.

Knack supports both command-level and argument-level validators.

If a command has a command-level validator, then any argument-level validators that would ordinarily be applied are ignored.

i.e. A command can have at most command validator or many argument level validators.

**Command-level Validators**

Command-level validators can operate on any arguments on the command. This is useful when you need to control the validation sequence.

**Argument-level Validators**

Argument-level validators should only operate on a single argument.

The order argument-level validators are executed in is not guaranteed so don't use multiple argument-level validators that rely on the same arguments.