Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

console #325

Merged
merged 14 commits into from
Oct 24, 2021
Merged

console #325

merged 14 commits into from
Oct 24, 2021

Conversation

lablnet
Copy link
Member

@lablnet lablnet commented Nov 28, 2020

As i was thinking since the long time about new improved console so finally i try to find time and work on it.

Its new console, which support to register commands etc..
A simple hello world command may look like this

<?php

namespace App\Console\Commands;
use Zest\Console\Command;

class Hello extends Command
{
    protected $sign = "hello";
    protected $description = "Command to print hello message on screen";

    public function handle()
    {
        $this->write("<green>Hello World.</green>");
    }
}

In Zest Skeleton it should added to
App/Config/Console.php

<?php

namespace Config;
use Zest\Console\Commands as InternalCommands;

class Commands extends InternalCommands {
    protected $commands = [
        ['hello',  \App\Console\Commands\Hello::class],
    ];
}

It also have few internals commands

Here is snapshot of list command
rsz_screenshot_from_2020-11-28_18-24-34

@peter279k and @Maikuolan what do yo think about this approach?

The symfony console exists no matter, but i love to reinvent wheel, and the motive of Zest framework.

@lablnet lablnet added Feature Request Proposal New idea/proposal labels Nov 28, 2020
@peter279k
Copy link
Member

Your works are very similar with Symfony/Components.

I don't think it's not very necessary to rebuild a console....Why don't you build a console on top of above component :)?

@lablnet
Copy link
Member Author

lablnet commented Nov 28, 2020

Your works are very similar with Symfony/Components.

I don't think it's not very necessary to rebuild a console....Why don't you build a console on top of above component :)?

Because

The main purpose of Zest framework is to provide a very lightweight framework without any external dependencies except core and autoloader

@Maikuolan
Copy link
Member

Maikuolan commented Nov 28, 2020

Seems like an interesting idea. Would be a nice addition to Zest, I think. :-)

I'm not super familiar with framework-based consoles though, TBH. Even Symfony's console, which seems to be reasonable popular AFAICT, isn't something I tend to ever use, except when necessary (e.g., when using a Symfony-based application which relies on their console).

@peter279k
Copy link
Member

Just notice that the console about Laravel framework relies on the Symfony/Console.

My main suggestion is: We should consider using the lightweight PHP console to build the console Zest framework.

It should be easy to build and it can avoid "repeating yourself" :).

@lablnet
Copy link
Member Author

lablnet commented Nov 28, 2020

My main suggestion is: We should consider using the lightweight PHP console to build the console Zest framework.

What do you mean by light weight php console

@peter279k

@peter279k
Copy link
Member

You can find the console via the packagist.org site.

@lablnet
Copy link
Member Author

lablnet commented Nov 28, 2020

You can find the console via the packagist.org site.

For now in this 'PR' I will continue a bit work the think about it. The proglen is that to include third party lib is violate term of Zest .

@peter279k
Copy link
Member

You can find the console via the packagist.org site.

For now in this 'PR' I will continue a bit work the think about it. The proglen is that to include third party lib is violate term of Zest .

Agree. Go ahead with that.

src/Console/Output.php Outdated Show resolved Hide resolved
@lablnet lablnet added enhancement New feature or request and removed Proposal New idea/proposal labels Nov 29, 2020
src/Console/Colorize.php Outdated Show resolved Hide resolved
src/Console/Command.php Outdated Show resolved Hide resolved
src/Console/Command.php Outdated Show resolved Hide resolved
src/Console/Command.php Outdated Show resolved Hide resolved
src/Console/Command.php Outdated Show resolved Hide resolved
src/Console/Output.php Outdated Show resolved Hide resolved
src/Console/Output.php Outdated Show resolved Hide resolved
@lablnet
Copy link
Member Author

lablnet commented Dec 11, 2020

TODO

  • Output List(s)
  • Parsing arguments and flags.
  • Support Args and flag in commands.

After that this PRwill ready to merge.

@lablnet lablnet merged commit 8c30135 into master Oct 24, 2021
@lablnet lablnet deleted the console branch October 24, 2021 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Feature Request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants