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>
64 lines
1.7 KiB
PHP
64 lines
1.7 KiB
PHP
#!/usr/bin/env php
|
|
<?php
|
|
/* Copyright (C) 2026 Moko Consulting <hello@mokoconsulting.tech>
|
|
*
|
|
* This file is part of a Moko Consulting project.
|
|
*
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
*
|
|
* FILE INFORMATION
|
|
* DEFGROUP: MokoStandards.Scripts.Fix
|
|
* INGROUP: MokoStandards
|
|
* REPO: https://git.mokoconsulting.tech/MokoConsulting/moko-platform
|
|
* PATH: /fix/fix_line_endings.php
|
|
* BRIEF: CLI script to fix line endings (CRLF → LF) in tracked files
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
require_once __DIR__ . '/../lib/CliBase.php';
|
|
require_once __DIR__ . '/../../vendor/autoload.php';
|
|
|
|
use MokoEnterprise\FileFixUtility;
|
|
|
|
/**
|
|
* CLI wrapper that delegates line-ending fixes to FileFixUtility.
|
|
*/
|
|
class FixLineEndings extends CliBase
|
|
{
|
|
/**
|
|
* Print usage information.
|
|
*/
|
|
protected function showHelp(): void
|
|
{
|
|
echo "Usage: {$this->scriptName} [--path DIR] [--dry-run] [--help]\n\n";
|
|
echo "Fixes CRLF line endings to LF in all tracked source files.\n\n";
|
|
echo "OPTIONS:\n";
|
|
echo " --path DIR Repository root (default: current directory)\n";
|
|
echo " --dry-run Show what would be changed without modifying files\n";
|
|
echo " --help Show this help message\n";
|
|
}
|
|
|
|
/**
|
|
* Run the line-ending fix via FileFixUtility.
|
|
*
|
|
* @return int Exit code: 0 on success.
|
|
*/
|
|
protected function execute(): int
|
|
{
|
|
$path = (string) ($this->getOption('path') ?? '.');
|
|
$files = FileFixUtility::fixLineEndings($path, $this->dryRun);
|
|
|
|
foreach ($files as $f) {
|
|
$this->success("Fixed: {$f}");
|
|
}
|
|
|
|
$label = $this->dryRun ? 'Would fix' : 'Fixed';
|
|
$this->log("{$label} " . count($files) . ' file(s)');
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
$script = new FixLineEndings($argv);
|
|
exit($script->run());
|