<commit_before><?php
namespace PhpBrew\Command;
use Exception;
use PhpBrew\Config;
use CLIFramework\Command;

class SelfUpdateCommand extends Command
{

    public function brief() { return 'self-update'; }

    public function execute()
    {
        global $argv;
        $script = realpath( $argv[0] );
        if( ! is_writable($script) ) {
            throw new Exception("$script is not writable.");
        }

        // fetch new version phpbrew
        $this->getLogger()->info("Fetching phpbrew to $script...");

        $url = 'https://raw.github.com/c9s/phpbrew/master/phpbrew';
        system("curl -# -L $url > $script") == 0 or die('Update failed.');

        $this->getLogger()->info("Version updated.");

        system( $script . ' --version' );
    }
}



<commit_msg>add brief and usage to self-update command.<commit_after><?php
namespace PhpBrew\Command;
use Exception;
use PhpBrew\Config;
use CLIFramework\Command;

class SelfUpdateCommand extends Command
{

    public function usage() { return 'phpbrew self-update [branch name]'; }

    public function brief() { return 'self-update, default to master version'; }

    public function execute($branch = 'master')
    {
        global $argv;
        $script = realpath( $argv[0] );
        if( ! is_writable($script) ) {
            throw new Exception("$script is not writable.");
        }

        // fetch new version phpbrew
        $this->logger->info("Updating phpbrew $script from $branch...");

        $url = "https://raw.github.com/c9s/phpbrew/$branch/phpbrew";
        system("curl -# -L $url > $script") == 0 or die('Update failed.');

        $this->logger->info("Version updated.");
        system( $script . ' --version' );
    }
}




{'fraction_non_alphanumeric': 0.15121668597914253, 'fraction_numerical': 0.0034762456546929316, 'mean_word_length': 2.605427974947808, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2877459', 'n_tokens_mistral': 523, 'n_tokens_neox': 508, 'n_words': 134}