<commit_before><?php

namespace NewUp\Console\Commands;

use Illuminate\Console\Command;
use NewUp\Contracts\Templates\StorageEngine;
use Symfony\Component\Console\Input\InputArgument;

class Update extends Command
{

    protected $templateStorageEngine;

    /**
     * The console command name.
     *
     * @var string
     */
    protected $name = 'template:update';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Updates a package template';

    public function __construct(StorageEngine $storageEngine)
    {
        parent::__construct();
        $this->templateStorageEngine = $storageEngine;
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        $packageName = $this->argument('name');

        if (!$this->templateStorageEngine->packageExists($packageName)) {
            $this->comment("The package {$packageName} is not currently installed.");

            return;
        }


        $this->line("Updating {$packageName}. Sit back and relax for a minute, this can take a while (it usually takes a little longer than an install).");
        $this->templateStorageEngine->updatePackage($packageName);
        $this->info("{$packageName} updated.");
    }


    protected function getArguments()
    {
        return [
            ['name', InputArgument::REQUIRED, 'The name of the package template to update', null]<commit_msg>Update offers to install if the template isn't installed<commit_after><?php

namespace NewUp\Console\Commands;

use Illuminate\Console\Command;
use NewUp\Contracts\Templates\StorageEngine;
use Symfony\Component\Console\Input\InputArgument;

class Update extends Command
{

    protected $templateStorageEngine;

    /**
     * The console command name.
     *
     * @var string
     */
    protected $name = 'template:update';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Updates a package template';

    public function __construct(StorageEngine $storageEngine)
    {
        parent::__construct();
        $this->templateStorageEngine = $storageEngine;
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        $packageName = $this->argument('name');

        if (!$this->templateStorageEngine->packageExists($packageName)) {
            if (!$this->confirm("The package {$packageName} is not currently installed. Would you like to install it instead? [yes|no]",
                false)
            ) {
                $this->comment("The package {$packageName} is not currently installed, and will not be installed right now.");

                return;
            } else {
                $this->comment("Okay, we will install the {$packageName} package template. Give us a moment to get things ready...");
                $this->call('template:install', ['name' => $packageName]);

                return;
            }
        }


        $this->line("Updating {$packageName}. Sit back and relax for a minute, this can take a while (it usually takes a little longer than an install).");
        $this->templateStorageEngine->updatePackage($packageName);
        $this->info("{$packageName} updated.");
    }


    protected function getArguments()
    {
        return [
            ['name', InputArgument::REQUIRED, 'The name of the package template to update', null]
{'fraction_non_alphanumeric': 0.11517576450414405, 'fraction_numerical': 0.0, 'mean_word_length': 2.5175879396984926, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 25, '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': '2467377', 'n_tokens_mistral': 900, 'n_tokens_neox': 880, 'n_words': 262}