Comments (16)
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.
These suggestions sound good to me.
from yii2.
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.
This was ment as you suggested, @tonydspaniard . The name color is very bad choice here :)
from yii2.
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.
@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.
@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.
Proposed: #144
from yii2.
@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.
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.
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.
Implemented. Also fixed ANSI color support detection.
from yii2.
What is the remaining work for this issue? I'm moving this out of alpha.
from yii2.
autocomplete i think, @cebe was suggesting in separate issue this feature, i think it is related.
from yii2.
@qiangxue there's ansiToHtml
in ConsoleBase
that looks far from being completed.
from yii2.
will try to finalise it this week.
from yii2.
Related Issues (20)
- BaseActiveRecord save method behaviour HOT 1
- Setting YII_DEBUG=false in humhub 1.15.2 leads to internal server error HOT 2
- Memory usage leak when long operation HOT 6
- createControllerByID function add cache? HOT 14
- Relational queries populating invalid models when foreign key / linking value is 0 HOT 1
- request` failed for
- asDuration() produce wrong plural form when using russian locale HOT 2
- hasOne or hasMany return null when $link with two bigint element
- YII2 whether support reset-transaction? HOT 1
- PHP Deprecated: Calling session_set_save_handler() in `PHP 8.4`. HOT 4
- If the iframe is nested in another domain name, there is an exception in the Yii2 site at https://, where there is a jump from http:// HOT 3
- Invalid fatal error handling in php 8.3 HOT 11
- Does yii2 support connection pooling using redis? HOT 1
- Wrong `columnQuoteCharacter` default in Schema for sqlite3 HOT 2
- wulan HOT 1
- Logic failed in RegularExpressionValidator
- Validator error handling in php 8.3 HOT 2
- How should I use Yii2 version 2.0.42.1 in my project HOT 3
- RequiredValidator with typed properties HOT 7
- Unable to resolve the request "--" with chroot HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yii2.