Skip to content

Commit dddfd34

Browse files
committed
init: init project from inhere/console
1 parent f834d70 commit dddfd34

27 files changed

+2559
-66
lines changed

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,4 @@ vendor/
1717
.phpstorm.meta.php
1818
.DS_Store
1919
.kite.php
20-
bin/php-cs-fixer
21-
/plugin/local/
2220
node_modules/

.php-cs-fixer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?php
22

33
$header = <<<'EOF'
4-
This file is part of phpcom-lab/cli-markdown.
4+
This file is part of toolkit/pflag.
55
6-
@link https://github.com/inhere
6+
@link https://github.com/php-toolkit
77
@author https://github.com/inhere
88
@license MIT
99
EOF;

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ help:
3333
clean: ## Clean all created artifacts
3434
git clean --exclude=.idea/ -fdx
3535

36-
cs-fix: ## Fix code style for all files
37-
gofmt -w ./
36+
csfix: ## Fix code style for all files
37+
php-cs-fixer fix ./
3838

3939
cs-diff: ## Display code style error files
4040
gofmt -l ./

README.md

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,23 @@
1-
# php-pkg-template
1+
# PHP Flag
22

3-
[![License](https://img.shields.io/packagist/l/inherelab/php-pkg-template.svg?style=flat-square)](LICENSE)
4-
[![Php Version](https://img.shields.io/badge/php-%3E=7.2.0-brightgreen.svg?maxAge=2592000)](https://packagist.org/packages/inherelab/php-pkg-template)
5-
[![GitHub tag (latest SemVer)](https://img.shields.io/github/tag/inherelab/php-pkg-template)](https://github.com/inherelab/php-pkg-template)
6-
[![Actions Status](https://github.com/inherelab/php-pkg-template/workflows/Unit-Tests/badge.svg)](https://github.com/inherelab/php-pkg-template/actions)
3+
[![License](https://img.shields.io/packagist/l/toolkit/pflag.svg?style=flat-square)](LICENSE)
4+
[![Php Version](https://img.shields.io/badge/php-%3E=7.2.0-brightgreen.svg?maxAge=2592000)](https://packagist.org/packages/toolkit/pflag)
5+
[![GitHub tag (latest SemVer)](https://img.shields.io/github/tag/toolkit/pflag)](https://github.com/toolkit/pflag)
6+
[![Actions Status](https://github.com/toolkit/pflag/workflows/Unit-Tests/badge.svg)](https://github.com/toolkit/pflag/actions)
77

8-
TODO: package description
8+
Command line flag parse library
99

1010
## Install
1111

1212
**composer**
1313

1414
```bash
15-
composer require inherelab/php-pkg-template
15+
composer require toolkit/pflag
1616
```
1717

1818
## Usage
1919

20-
- clone this repository to local
21-
- update readme description
22-
- search all `inherelab/php-pkg-template` and replace to your package name.
23-
- update `composer.json` contents: name, description, require, autoload
20+
TODO
2421

2522
## License
2623

composer.json

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
2-
"name": "inherelab/php-pkg-template",
3-
"description": "TODO: package description",
4-
"type": "template",
2+
"name": "toolkit/pflag",
3+
"description": "Command line flag parse library of the php",
4+
"type": "library",
55
"license": "MIT",
6-
"homepage": "https://github.com/inherelab/php-pkg-template",
6+
"homepage": "https://github.com/php-toolkit/pflag.git",
77
"authors": [
88
{
99
"name": "inhere",
@@ -13,15 +13,21 @@
1313
"require": {
1414
"php": ">7.1.0",
1515
"ext-mbstring": "*",
16-
"toolkit/cli-utils":"~1.0"
16+
"toolkit/cli-utils":"~1.0",
17+
"toolkit/stdlib":"~1.0"
1718
},
1819
"autoload": {
1920
"psr-4": {
20-
"PkgOwner\\PkgName\\": "src/"
21+
"Toolkit\\PFlag\\": "src/"
22+
}
23+
},
24+
"autoload-dev": {
25+
"psr-4": {
26+
"Toolkit\\PFlagTest\\": "test/"
2127
}
2228
},
2329
"bin": [
24-
30+
2531
],
2632
"scripts": {
2733
"test": "php vender/bin/phpunit"

example/demo.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
<?php
1+
<?php declare(strict_types=1);
2+
/**
3+
* This file is part of toolkit/pflag.
4+
*
5+
* @link https://github.com/php-toolkit
6+
* @author https://github.com/inhere
7+
* @license MIT
8+
*/
29

310
use PhpComLab\CliMarkdown\CliMarkdown;
411

@@ -10,4 +17,3 @@
1017
$rendered = $praser->render($contents);
1118

1219
echo $rendered;
13-

phar.build.inc

Lines changed: 0 additions & 38 deletions
This file was deleted.

src/.keep

Whitespace-only changes.

src/Contract/FlagInterface.php

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<?php declare(strict_types=1);
2+
/**
3+
* This file is part of toolkit/pflag.
4+
*
5+
* @link https://github.com/php-toolkit
6+
* @author https://github.com/inhere
7+
* @license MIT
8+
*/
9+
10+
namespace Toolkit\PFlag\Contract;
11+
12+
/**
13+
* Interface FlagInterface
14+
*
15+
* @package Toolkit\PFlag\Contract
16+
*/
17+
interface FlagInterface
18+
{
19+
// fixed args and opts for a command/controller-command
20+
public const ARG_REQUIRED = 1;
21+
22+
public const ARG_OPTIONAL = 2;
23+
24+
public const ARG_IS_ARRAY = 4;
25+
26+
public const OPT_BOOLEAN = 1; // eq symfony InputOption::VALUE_NONE
27+
28+
public const OPT_REQUIRED = 2;
29+
30+
public const OPT_OPTIONAL = 4;
31+
32+
public const OPT_IS_ARRAY = 8;
33+
34+
/**
35+
* @param int $mode
36+
*
37+
* @return bool
38+
*/
39+
public function hasMode(int $mode): bool;
40+
41+
/**
42+
* @return bool
43+
*/
44+
public function isArray(): bool;
45+
46+
/**
47+
* @return bool
48+
*/
49+
public function isRequired(): bool;
50+
51+
/**
52+
* @return bool
53+
*/
54+
public function isOptional(): bool;
55+
}

src/Contract/ParserInterface.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php declare(strict_types=1);
2+
/**
3+
* This file is part of toolkit/pflag.
4+
*
5+
* @link https://github.com/php-toolkit
6+
* @author https://github.com/inhere
7+
* @license MIT
8+
*/
9+
10+
namespace Toolkit\PFlag\Contract;
11+
12+
/**
13+
* interface ParserInterface
14+
*/
15+
interface ParserInterface
16+
{
17+
}

0 commit comments

Comments
 (0)