Coder Social home page Coder Social logo

console's People

Contributors

djmattyg007 avatar lyrixx avatar pkruithof avatar rommsen avatar sstok avatar stof avatar tgalopin avatar tolry avatar webmozart avatar wouterj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

console's Issues

How to set default command?

Hi, thanks for the library!

I have a program with the run command, how to set it as the default command?

My code:

$this->beginCommand('run')
                ->markDefault()
                ->setDescription('Run analizer metrics')
                ->setHandler(new \Insphptor\Program\Commands\RunCommand())
                ->beginSubCommand('export')
                    ->setHandlerMethod('export')
                    ->setDescription('Export result in ' . config()['export'] . ' file')
                    ->addArgument('view', Argument::OPTIONAL, 'The view system', 'default')
                    ->addOption('open', 'o', Option::BOOLEAN, 'Open server with result in view')
                ->end()
        ->end();

The markDefault no work, has alternative for it?

Table separator

Is there a way to render table separator, just like in Symfony Console?

$table->addRow(new TableSeparator);

Missing methods in ApplicationConfig

During my work on a puli/cli ticket I get the following Scrutinizer bug message:

The method beginOptionCommand does only exist in Webmozart\Console\Api\Config\CommandConfig, but not in Webmozart\Console\Api\Config\ApplicationConfig.

This may be an issue for projects switching from CommandConfig to ApplicationConfig.

It looks like the classes in the Config namespace need an interface or some template methods in the abstract Config class.

@webmozart: What would you prefer to make the classes replaceable by offering the same API?

Error: Call to a member function getOptions() on null

I currently try to setup an cli application with this library. I stepped through the instructions from the README file and now wanted to test my setup, but I run into this error:

(paths are slightly shortened for readability)

PHP Fatal error:  Uncaught Error: Call to a member function getOptions() on null in .../vendor/webmozart/console/src/Api/Config/Config.php:122
Stack trace:
#0 .../vendor/webmozart/console/src/ConsoleApplication.php(122): Webmozart\Console\Api\Config\Config->getOptions()
#1 .../Bin/melior(30): Webmozart\Console\ConsoleApplication->__construct(Object(Melior\CLI\MeliorApplicationConfig))
#2 {main}
  thrown in .../vendor/webmozart/console/src/Api/Config/Config.php on line 122

Fatal error: Uncaught Error: Call to a member function getOptions() on null in .../vendor/webmozart/console/src/Api/Config/Config.php on line 122

Error: Call to a member function getOptions() on null in .../vendor/webmozart/console/src/Api/Config/Config.php on line 122

Call Stack:
    0.0022     359184   1. {main}() .../Bin/melior:0
    0.5231    2424888   2. Webmozart\Console\ConsoleApplication->__construct() .../Bin/melior:30
    0.5775    3043232   3. Melior\CLI\MeliorApplicationConfig->getOptions() .../vendor/webmozart/console/src/ConsoleApplication.php:122

This occures with the full setup but also with rudimentary setup (just setting name and version for the app). I tried to debug this up to some point, but I had no success by now. The error message always stays the same and I don't really get why, thus I'm assuming a bug in the library.

As far as I can see, the ConsoleApplication somehow invokes the method getOptions() on my configuration class but I can't find an instruction to add this method manually, neither there is a corresponding method in the DefaultApplicationConfig class.

You can find all related files that are involved in the setup here: https://gist.github.com/MCStreetguy/ef98687affd1adc75d7584ce18fa46e4

Thanks in advance for participation in my problem, Max.

Wrong display of long option description

When I add an option with a long description the text wraps incorrectly.

See the description of the --project-folder option.
screen-img

->addOption(
    'project-folder',
    null,
    Option::OPTIONAL_VALUE,
    'The root folder of the project, this is where the ".dancer" folder is located. '.
    'When omitted the folder is automatically searched by the first occurrence of the ".dancer" folder
    in the parent directory structure, and falls back to the current working.'
)

[meta] Integrate hoa/console

Hello :-),

This is more a meta issue in order to discuss about your wishes to integrate Hoa\Console inside this awesome project (cf. your initial tweet and the tweet about opening an issue).

Recapitulare

Hoa\Console is more a low-level API for the terminal. First of all, every API is based on tput (aka terminal info' or terminal capabitilies). This makes everything much more compatible with the plenty of terminals we have in the wild (see Control the terminal, the right way). Based on that, we —at Hoa— have designed an API for the cursor (Hoa\Console\Cursor), the window (Hoa\Console\Window) and the mouse (Hoa\Console\Mouse). And based on that, we have designed a powerful readline (Hoa\Console\Readline), with, of course, autocompleters. Example:

Autocompleters in action

Apart from that, we have also designed an option parser and reader (resp. Hoa\Console\Parser and Hoa\Console\GetOption). They are “standalone” classes. To make it works easier with the rest of the environment, we provide Hoa\Router\Cli as another class of another library. And Hoa\Console\Dispatcher\Kit with Hoa\Dispatcher (another library) ease the development of complete commands (as defined by your project). Hoa\Router and Hoa\Dispatcher are totally optional, this must be clear.

Finally, there is also processus control with Hoa\Console\Processus: Allowing to interactivly communicate with a processus (->on('output'), ->on('input') etc.).

The documentation of Hoa\Console can be found on Hoa's website: http://hoa-project.net/Literature/Hack/Console.html.

Needs and wishes

Now, we are ready to collaborate to integrate Hoa\Console inside webmozart/console because we think this project provides a very nice high-level API. This kind of API is missing in Hoa since this is out of our goal and it can “hurt” users in some particular cases. I personally think we have a big opportunity to make a great tool here!

The only question I have is: What are your needs and wishes?

/cc @hoaproject/hoackers and especially @jubianchi who did write the Symfony bridge to Hoa\Console with the bundle. Maybe these projects can be re-used.

Any widget like ProgressBar,confirm,select etc. like yii2 Concole component did.

see what yii2 have

clearScreen
clearScreenBeforeCursor
saveCursorPosition
moveCursorUp
updateProgress
select
error
beginAnsiFormat
xtermBgColor
moveCursorDown
stdin
startProgress
scrollDown
scrollUp
ansiFormatCode
renderColoredString
input
moveCursorNextLine
showCursor
wrapText
ansiToHtml
output
stdout
clearLine
endProgress
confirm
hideCursor
isRunningOnWindows
moveCursorForward
restoreCursorPosition
BaseConsole
ansiFormat
xtermFgColor
ansiStrlen
getScreenSize
clearLineBeforeCursor
stderr
moveCursorBackward
streamSupportsAnsiColors
moveCursorTo
escape
clearLineAfterCursor
markdownToAnsi
moveCursorPrevLine
stripAnsiFormat
endAnsiFormat
clearScreenAfterCursor
prompt

I tinks this is very convenience to have the ability to draw these widgets
Any plan to adding this feature?

ChoiceQuestion use <hl> tag when auto-completing

Hey there,

When using the symfony's ChoiceQuestion with this console, we end up with a wrong auto-completion containing <hl> tags.

Example:

Hello world?
  [0] yes
  [1] no
 > y<hl>es</hl>

The fix is quite easy on my side:

$configuration->addStyle(Style::tag('hl')->bold());

But I think it could be nice to implement it directly in the library.

Cheers mate,
Alain

Is it possible to use Symfony Helpers (i.e. Questions etc.)?

Hi,

awesome library.

I am thinking of ditching symfony console in favor of this one. But we make heavy usage of Symfonys Helpers (http://symfony.com/doc/current/components/console/helpers/questionhelper.html etc.). Here: #7 it says that its available but I am not sure how to use it.

I was thinking about

public function handleAdd(Args $args, IO $io, Command $command)
{
    $helper = new QuestionHelper();
    $question = new ChoiceQuestion(
        'Please select your favorite colors (defaults to red and blue)',
        array('red', 'blue', 'yellow'),
        '0,1'
    );
    $question->setMultiselect(true);
    $colors = $helper->ask($io->getInput(), $io->getOutput(), $question);

but I get
QuestionHelper::ask() must implement interface Symfony\Component\Console\Input\InputInterface, instance of Webmozart\Console\Api\IO\Input given

Is it correct that I can not use the helpers?

Is the command name character restriction necessary?

I recently set up a command line application with this library and I'm very impressed about it.
The possibilities totally fulfill what I tried to achieve.

But now I stumbled upon a restriction in the command names.
I wanted to create "namespaced" commands, just as e.g. the Flow Framework does.
I tried to register core:cache:flush but I receive an Exception, telling me that only word characters and hyphens could be used as name.

Is there any reasonable cause for this restriction?
Would it be possible to add more chars to the pattern or even leave the naming completely up to the developer?

Is the project still alive?

Sorry to bother but the project hasn't received an update in a very long time. I'm looking for something like this and I wonder if this is still being developed. Thanks.

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.