<commit_before><?php
/*
 * This file is part of the RBot.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
namespace RBot\Commands;

use RBot\RBot;
use RBot\Command;
use RBot\Console;

/*
 * Generic test function for rbot 
 *
 * Do nothing
 */
class TestCommand extends Command 
{
    /**
     * Command Options
     */
    public function setOptions() 
    {
        $this->_options->add('h|help', 'test' );
        $this->_options->add('f|foo:', 'option requires a value.' )
            ->isa('String');

        $this->_options->add('b|bar+', 'option with multiple value.' )
            ->isa('Number');

        $this->_options->add('z|zoo?', 'option with optional value.' )
            ->isa('Boolean')
            ;

        $this->_options->add('o|output?', 'option with optional value.' )
            ->isa('File');
            //->defaultValue('output.txt');

        // works for -vvv  => verbose = 3
        $this->_options->add('v|verbose', 'verbose')
            ->isa('Number')
            ->incremental();

        $this->_options->add('file:', 'option value should be a file.' )
            ->trigger(function($value) {
                echo "Set value to :";
                var_dump($value);
            })
            ->isa('File');

        $this->_options->add('d|date', 'show date time' );
        $this->_options->add('long', 'long option name only.' );
        $this->_options->add('s', 'short option name only.' );
        $this->_options->add('m', 'short option m');
        $this->_options->add('4', 'short option with digit');
    }

    /**
     * Process the command
     */
    public function process()
    {
        if(!$this->hasResult()) $this->help();
        //$this->debug();

        /*Console::add(RBot::conf('db').'43434');
        Console::output();*/
    }

    /**
     * Command option "foo"
     * 
     * @param  mixed $value
     */
    public function opt_foo($value)
    {
        Console::nl();
        Console::add("Foo >>> ".$value);
        Console::output();
    }

    /**
     * Command option "date"
     * 
     * @param  mixed $value
     */
    public function opt_date($value)
    {
        Console::add(date('Y-m-d H:i:s'), ['color'=>'#fff']);
        Console::output();
    }
}<commit_msg>updated test command<commit_after><?php
/*
 * This file is part of the RBot.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
namespace RBot\Commands;

use RBot\RBot;
use RBot\Command;
use RBot\Console;

/*
 * Generic test function for rbot 
 *
 * Do nothing
 */
class TestCommand extends Command 
{
    /**
     * Command Options
     */
    public function setOptions() 
    {
        $this->_options->add('h|help', 'test' );
        $this->_options->add('f|foo:', 'option requires a value.' )
            ->isa('String');

        $this->_options->add('b|bar+', 'option with multiple value.' )
            ->isa('Number');

        $this->_options->add('z|zoo?', 'option with optional value.' )
            ->isa('Boolean')
            ;

        $this->_options->add('o|output?', 'option with optional value.' )
            ->isa('File');
            //->defaultValue('output.txt');

        // works for -vvv  => verbose = 3
        $this->_options->add('v|verbose', 'verbose')
            ->isa('Number')
            ->incremental();

        $this->_options->add('file:', 'option value should be a file.' )
            ->trigger(function($value) {
                echo "Set value to :";
                var_dump($value);
            })
            ->isa('File');

        $this->_options->add('d|date', 'show date time' );
        $this->_options->add('long', 'long option name only.' );
        $this->_options->add('s', 'short option name only.' );
        $this->_options->add('m', 'short option m');
        $this->_options->add('4', 'short option with digit');
        $this->_options->add('url?', 'url option')->isa('url');
        $this->_options->add('ip?', 'ip option')->isa('ip');
        $this->_options->add('ipv4?', 'ipv4 option')->isa('ipv4');
        $this->_options->add('ipv6?', 'ipv6 option')->isa('ipv6');
    }

    /**
     * Process the command
     */
    public function process()
    {
        if(!$this->hasResult() && !$this->hasErrors()) $this->help();
        //$this->debug();

        /*Console::add(RBot::conf('db').'43434');
        Console::output();*/
    }

    /**
     * Command option "foo"
     * 
     * @param  mixed $value
     */
    public function opt_foo($value)
    {
        Console::nl();
        Console::add("Foo >>> ".$value);
        Console::output();
    }

    /**
     * Command option "ip"
     * 
     * @param  mixed $value
     */
    public function opt_ip($ip)
    {
        Console::nl();
        Console::add("ip >>> ".$ip);
        Console::output();
    }

    /**
     * Command option "ipv4"
     * 
     * @param  mixed $value
     */
    public function opt_ipv4($ip)
    {
        $this->opt_ip($ip);
    }
    
    /**
     * Command option "ipv6"
     * 
     * @param  mixed $value
     */
    public function opt_ipv6($ip)
    {
        $this->opt_ip($ip);
    }


    /**
     * Command option "date"
     * 
     * @param  mixed $value
     */
    public function opt_date($value)
    {
        Console::add(date('Y-m-d H:i:s'), ['color'=>'#fff']);
        Console::output();
    }
}
{'fraction_non_alphanumeric': 0.19026149684400362, 'fraction_numerical': 0.004328223624887286, 'mean_word_length': 1.9721329046087888, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 109, 'https://': 0, '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': '5975924', 'n_tokens_mistral': 1711, 'n_tokens_neox': 1673, 'n_words': 376}