1d87be7d5e
Branch Policy Check / Verify merge target (pull_request) Successful in 1s
- Update REPO: from MokoStandards-API to moko-platform in 125 files - Fix wrong org path (mokoconsulting-tech → MokoConsulting) in 10 files - Fix SPDX-LICENSE-IDENTIFIER case in 2 template files - Add missing REPO: field to 3 files Authored-by: Moko Consulting Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
41 lines
998 B
PHP
41 lines
998 B
PHP
#!/usr/bin/env php
|
|
<?php
|
|
/* Copyright (C) 2026 Moko Consulting <hello@mokoconsulting.tech>
|
|
*
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
*
|
|
* FILE INFORMATION
|
|
* DEFGROUP: MokoStandards.CLI
|
|
* INGROUP: MokoStandards
|
|
* REPO: https://git.mokoconsulting.tech/MokoConsulting/moko-platform
|
|
* PATH: /cli/platform_detect.php
|
|
* BRIEF: Detect platform from .mokostandards file — outputs platform string
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
$path = '.';
|
|
foreach ($argv as $i => $arg) {
|
|
if ($arg === '--path' && isset($argv[$i + 1])) $path = $argv[$i + 1];
|
|
}
|
|
|
|
$root = realpath($path) ?: $path;
|
|
// Check .github/.mokostandards first, fallback to root
|
|
$file = "{$root}/.github/.mokostandards";
|
|
if (!file_exists($file)) {
|
|
$file = "{$root}/.mokostandards";
|
|
}
|
|
if (!file_exists($file)) {
|
|
echo "unknown\n";
|
|
exit(0);
|
|
}
|
|
|
|
$content = file_get_contents($file);
|
|
if (preg_match('/^platform:\s*(.+)/m', $content, $m)) {
|
|
echo trim($m[1], " \t\n\r\"'") . "\n";
|
|
} else {
|
|
echo "unknown\n";
|
|
}
|
|
|
|
exit(0);
|