Skip to content

Conversation

@nmalevanec
Copy link
Contributor

@nmalevanec nmalevanec commented Feb 20, 2018

Original Pull Requests

#11504
#13698

Description

Gives a helper object to access styling objects in symfony console easier.

How to use it

Instantiate inside a command object's methods (usually interact and execute but not limited to)
$io = new MagentoStyle($input,$output);

  1. Titles: Creates a title header with a double bar underline
    $io->title("My Title");

  2. Sections: Creates a section header with a single bar underline
    $io->section("My Section");

  3. Content Output:
    Creates a text block
    $io->text("Your message here");
    Creates a bulleted list
    $io->listing(["item1","item2","item3"]);
    Creates a table
    $io->table(["header1","header2","header3"],[ ["A","B","C"], ["D","E","F"], ["G","H","I"] ]);
    Prints a new line
    $io->newLine();

  4. Admonition Methods: success, warning, caution, note, comment
    Print out a padded and colored message
    $io->success("You Win!");
    $io->error("You Fail!");

  5. Progress Bar
    Creates an interactive progress bar
    $io->progressStart(100);
    $io->progressAdvance(10);
    $io->progressFinish();

  6. Questions
    $io->ask("What is your name?");
    $io->confirm("Are you sure?");
    $io->choice("What is your favorite color?",["red,"blue","yellow"]);

  7. Questions for missing arguments and options
    $io->askForMissingArgument( $argument, $question, $default = null, $validator = null, $maxAttempts = null, $comment = null, $commentFormat = "Argument [%s] set to: %s" )
    $io->askForMissingOption( $option, $question, $default = null, $validator = null, $maxAttempts = null, $comment = null, $commentFormat = "Option [%s] set to: %s" )

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • [-] All new or changed code is covered with unit/integration tests (if applicable)
  • [-] All automated tests passed successfully (all builds on Travis CI are green)

@magento-engcom-team
Copy link
Contributor

Hi @ihor-sviziev, thank you for the review.
MAGETWO-88045 has been created to process this Pull Request

@magento-engcom-team magento-engcom-team merged commit 7be9367 into magento:2.3-develop Feb 26, 2018
magento-engcom-team pushed a commit that referenced this pull request Feb 26, 2018
… helper object to allow easier access to io helpers in symfony/console #13741
@nmalevanec nmalevanec deleted the 2.3-develop-PR-port-11504 branch August 21, 2018 07:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants