#file-content #text-file #command-line-tool #json-toml #yaml #enforcing #yaml-json-toml-text

bin+lib you-must-conform

一个用于强制执行 YAML|JSON|TOML|文本文件内容的命令行工具

4 个版本 (稳定)

1.1.1 2022 年 4 月 6 日
1.0.0 2022 年 4 月 6 日
0.1.0 2022 年 4 月 4 日

#5 in #强制执行

MIT 许可证

22KB
433

you-must-conform

crates-io docs-rs github

一个用于强制执行 YAML|JSON|TOML|文本文件内容的命令行工具。

用法

# conform.yaml
config:
- file: Cargo.toml
  format: toml
  schema:                   # Ensure these nested keys are set
    package:
      edition: "2021"
- file: Cargo.lock
  exists: true              # Ensure this file exists
- file: src/lib.rs
  matches-regex: '(?m)^use' # Ensure this regex is matched in the file

include:                    # (Recursively) merge config from these urls
- https://example.com/another-conform.yaml

$ you-must-conform --help
you-must-conform 1.1.0
A command-line tool for enforcing YAML|JSON|TOML|text file contents.

USAGE:
    you-must-conform [OPTIONS] <--file <FILE>|--url <URL>>

OPTIONS:
    -c, --context <CONTEXT>    The folder to check against the config file [default: .]
    -f, --file <FILE>          The config file to check [default: conform.yaml]
    -h, --help                 Print help information
    -u, --url <URL>            A url to fetch the config file from instead
    -V, --version              Print version information

$ you-must-conform
Schema not matched in ./Cargo.toml:
    "package" is a required property
File ./Cargo.lock does not exist
File ./src/lib.rs does not match regex (?m)^use
Error: Found 3 problems

许可证:MIT

依赖项

~16–30MB
~492K SLoC