Giter VIP home page Giter VIP logo

Comments (16)

tonydspaniard avatar tonydspaniard commented on May 30, 2024

Instead of ConsoleColor why is not called Console and make other utility functions to work with terminals? For example:

  • prompt
  • select
  • confirm
  • download
  • progress <-- to display download information for example
  • etc

from yii2.

qiangxue avatar qiangxue commented on May 30, 2024

These suggestions sound good to me.

from yii2.

Ragazzo avatar Ragazzo commented on May 30, 2024

afaik there is a very good solution for console in the Antonio's new boilerplates, even with daemon written on php, can we take console functionality from there? would be very useful.

from yii2.

cebe avatar cebe commented on May 30, 2024

This was ment as you suggested, @tonydspaniard . The name color is very bad choice here :)

from yii2.

cebe avatar cebe commented on May 30, 2024

Instead of color we should talk about using ANSI control codes.
The main problem to solve here is to make it work in every terminal and have a fallback.
We may have a switch to turn ANSI control codes on and off. It may be on by default on linux machines and off on windows, but would be even better if we could detect whether we are running in a terminal or not.

from yii2.

tonydspaniard avatar tonydspaniard commented on May 30, 2024

@cebe I agree... there is not really a good solution for its support on Windows (not as far as I know). Nevertheless, if we forced to do so, here is a good reference and easiest way to do it:

from yii2.

samdark avatar samdark commented on May 30, 2024

@tonydspaniard that will work with windows XP and less + most of console wrappers such as ConEmu or ANSICON. I think it's enough if we'll like to these tools from the guide or API docs.

from yii2.

tonydspaniard avatar tonydspaniard commented on May 30, 2024

Proposed: #144

from yii2.

cebe avatar cebe commented on May 30, 2024

@tonydspaniard thanks for you proposal so far, I have refactored it a bit.
I think it is cool to have wrappers in console/Controller that adds the magic of whether ansi support is enabled or not and also if the command runs interactive or not. The raw stuff will be in Console helper.
I'd like to hear your feedback on this.

from yii2.

cebe avatar cebe commented on May 30, 2024

I think we should also adopt something like strlen and strpad from:
https://github.com/tonydspaniard/php-cli-tools/blob/master/lib/cli/Colors.php

Also for inspiration: http://symfony.com/doc/current/components/console/introduction.html

from yii2.

cebe avatar cebe commented on May 30, 2024

Implemented Console::getScreenSize() for linux. Would be cool if someone else could do it for windows, as I don't have a windows system here to test currently.

http://stackoverflow.com/a/7575044/1106908

from yii2.

samdark avatar samdark commented on May 30, 2024

Implemented. Also fixed ANSI color support detection.

from yii2.

qiangxue avatar qiangxue commented on May 30, 2024

What is the remaining work for this issue? I'm moving this out of alpha.

from yii2.

Ragazzo avatar Ragazzo commented on May 30, 2024

autocomplete i think, @cebe was suggesting in separate issue this feature, i think it is related.

from yii2.

samdark avatar samdark commented on May 30, 2024

@qiangxue there's ansiToHtml in ConsoleBase that looks far from being completed.

from yii2.

cebe avatar cebe commented on May 30, 2024

will try to finalise it this week.

from yii2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.