zero-to-prod/validate-semver-cli 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

zero-to-prod/validate-semver-cli

最新稳定版本:v1.1.0

Composer 安装命令:

composer require zero-to-prod/validate-semver-cli

包简介

A CLI for validating a semantic version string.

README 文档

README

Repo GitHub Actions Workflow Status GitHub Actions Workflow Status GitHub Actions Workflow Status Packagist Downloads php Packagist Version License wakatime Hits-of-Code

Contents

Introduction

A CLI for validating a semantic version string.

Requirements

  • PHP 8.1 or higher.

Installation

Install Zerotoprod\ValidateSemverCli via Composer:

composer require zero-to-prod/validate-semver-cli

This will add the package to your project's dependencies and create an autoloader entry for it.

Documentation Publishing

You can publish this README to your local documentation directory.

This can be useful for providing documentation for AI agents.

This can be done using the included script:

# Publish to default location (./docs/zero-to-prod/validate-semver-cli)
vendor/bin/zero-to-prod-validate-semver-cli

# Publish to custom directory
vendor/bin/zero-to-prod-validate-semver-cli /path/to/your/docs

Automatic Documentation Publishing

You can automatically publish documentation by adding the following to your composer.json:

{
    "scripts": {
        "post-install-cmd": [
            "zero-to-prod-validate-semver-cli"
        ],
        "post-update-cmd": [
            "zero-to-prod-validate-semver-cli"
        ]
    }
}

Usage

Run this command to see the available commands:

vendor/bin/validate-semver-cli list

Available Commands

The CLI provides three main commands for working with semantic version validation:

validate-semver-cli:validate

Validates a semantic version string and returns the string if valid, or empty output if invalid.

Usage:

vendor/bin/validate-semver-cli validate-semver-cli:validate <semver>

Arguments:

  • semver (required) - The semantic version string to validate

Examples:

Valid semantic version:

vendor/bin/validate-semver-cli validate-semver-cli:validate "1.2.3"

Output:

1.2.3

Valid semantic version with pre-release:

vendor/bin/validate-semver-cli validate-semver-cli:validate "2.0.0-alpha.1"

Output:

2.0.0-alpha.1

Valid semantic version with build metadata:

vendor/bin/validate-semver-cli validate-semver-cli:validate "1.0.0+20230101"

Output:

1.0.0+20230101

Invalid semantic version:

vendor/bin/validate-semver-cli validate-semver-cli:validate "1.2"

Output:


validate-semver-cli:show-regex

Displays the regular expression pattern used to validate semantic version strings.

Usage:

vendor/bin/validate-semver-cli validate-semver-cli:show-regex

Arguments: None

Example:

vendor/bin/validate-semver-cli validate-semver-cli:show-regex

Output:

^(?P<major>0|[1-9]\d*)\.(?P<minor>0|[1-9]\d*)\.(?P<patch>0|[1-9]\d*)(?:-(?P<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?P<buildmetadata>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$

validate-semver-cli:src

Displays the project's source repository URL.

Usage:

vendor/bin/validate-semver-cli validate-semver-cli:src

Arguments: None

Example:

vendor/bin/validate-semver-cli validate-semver-cli:src

Output:

https://github.com/zero-to-prod/validate-semver-cli

Docker Image

You can also run the cli using the docker image:

docker run --rm davidsmith3/validate-semver-cli

Contributing

Contributions, issues, and feature requests are welcome! Feel free to check the issues page if you want to contribute.

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature-branch).
  3. Commit changes (git commit -m 'Add some feature').
  4. Push to the branch (git push origin feature-branch).
  5. Create a new Pull Request.

统计信息

  • 总下载量: 275
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-01-28