8000 [Console] Add DialogHelper::askHiddenResponse method by romainneutron · Pull Request #5731 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Console] Add DialogHelper::askHiddenResponse method #5731

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

Merged
merged 6 commits into from
Oct 16, 2012

Conversation

romainneutron
Copy link
Contributor

Bug fix: no
Feature addition: yes
Backwards compatibility break: no
Symfony2 tests pass: yes
License of the code: MIT

It adds a method to DialogHelper to ask a question and hide the response. It's pretty cool when working with passwords.

This code is more than largely inspired by Composer, see ConsoleIO.php at line 140

You will notice that this PR embeds a Windows Executable binary for windows support. This windows binary is provided by @Seldaek (see https://github.com/Seldaek/hidden-input)
This dependency is not yet available via composer.

If this is a problem to embed this file, we can think of other way to provide this support (make a package from HiddenInput and add composer recommandation for example).

}

return $value;
} elseif ($this->hasSttyAvailable()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you don't need the elseif, just if

@stof
Copy link
Member
stof commented Oct 11, 2012

The link to the hiddeninput source code should be added in the readme.
And you should also update the changelog.

Btw, adding composer for hiddeninput does not make sense. Compsoer is about installing PHP code, not about downloading the source of a C++ program.

@romainneutron
Copy link
Contributor Author

This proposition comes from a discussion I had with Jordi , nothing more :)

Romain

On 11 oct. 2012, at 19:20, Christophe Coevoet notifications@github.com
wrote:

The link to the hiddeninput source code should be added in the readme.
And you should also update the changelog.

Btw, adding composer for hiddeninput does not make sense. Compsoer is about
installing PHP code, not about downloading the source of a C++ program.


Reply to this email directly or view it on
GitHubhttps://github.com//pull/5731#issuecomment-9349736.

@romainneutron
Copy link
Contributor Author

Changelog updated, Readme note added, CS fixed

$dialog->setInputStream($this->getInputStream("8AM\n"));

$this->assertEquals('8AM', $dialog->askHiddenResponse($this->getOutputStream(), 'What time is it?'));
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test should be skipped on Windows as it would trigger the binary, which will not work.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's fixed

@stof
Copy link
Member
stof commented Oct 13, 2012

the missing point is now the PR to the doc for this new feature

Third Party
-----------

`HiddenInput.exe` third party binary is provided within this component. Find
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The file is called hiddeninput.exe all lowercased

@romainneutron
Copy link
Contributor Author

@stof documentation added

*
* @return string The answer
*
* @throws \RuntimeException In case the fallback is disactivated and the response can not be hidden
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

disactivated should be deactivated

@romainneutron
Copy link
Contributor Author

@fabpot what you asked is now fixed

fabpot added a commit that referenced this pull request Oct 16, 2012
This PR was merged into the master branch.

Commits
-------

aefa495 Mov
80D9
e `hiddeninput.exe` to Resources/bin
c0f8a63 Fix CS and typos
26c35e0 Skip askHiddenResponse test on windows
e2eaf5a Update Changelog, add Readme note about hidden input third party
ac01d5d Fix tests and CS
e396edb [Console] Add DialogHelper::askHiddenResponse method

Discussion
----------

[Console] Add DialogHelper::askHiddenResponse method

Bug fix: no
Feature addition: yes
Backwards compatibility break: no
Symfony2 tests pass: yes
License of the code: MIT

It adds a method to `DialogHelper` to ask a question and hide the response. It's pretty cool when working with passwords.

This code is more than largely inspired by Composer, see [ConsoleIO.php at line 140](https://github.com/composer/composer/blob/master/src/Composer/IO/ConsoleIO.php#L140)

 You will notice that this PR embeds a Windows Executable binary for windows support. This windows binary is provided by @Seldaek (see https://github.com/Seldaek/hidden-input)
This dependency is not yet available via composer.

If this is a problem to embed this file, we can think of other way to provide this support (make a package from HiddenInput and add composer recommandation for example).

---------------------------------------------------------------------------

by stof at 2012-10-11T17:20:11Z

The link to the hiddeninput source code should be added in the readme.
And you should also update the changelog.

Btw, adding composer for hiddeninput does not make sense. Compsoer is about installing PHP code, not about downloading the source of a C++ program.

---------------------------------------------------------------------------

by romainneutron at 2012-10-11T17:22:58Z

This proposition comes from a discussion I had with Jordi , nothing more :)

Romain

On 11 oct. 2012, at 19:20, Christophe Coevoet <notifications@github.com>
wrote:

The link to the hiddeninput source code should be added in the readme.
And you should also update the changelog.

Btw, adding composer for hiddeninput does not make sense. Compsoer is about
installing PHP code, not about downloading the source of a C++ program.

—
Reply to this email directly or view it on
GitHub<#5731 (comment)>.

---------------------------------------------------------------------------

by romainneutron at 2012-10-12T07:33:00Z

Changelog updated, Readme note added, CS fixed

---------------------------------------------------------------------------

by stof at 2012-10-13T22:09:24Z

the missing point is now the PR to the doc for this new feature

---------------------------------------------------------------------------

by romainneutron at 2012-10-16T00:33:59Z

@stof documentation added

---------------------------------------------------------------------------

by romainneutron at 2012-10-16T09:10:35Z

@fabpot what you asked is now fixed
@fabpot fabpot merged commit aefa495 into symfony:master Oct 16, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants
0