Skip to content
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

Display full help with 'help' function #5195

Merged

Conversation

rkeithhill
Copy link
Collaborator

Display full help on Windows systems where user has overriden pager with $env:PAGER.

Fix #4962

@rkeithhill
Copy link
Collaborator Author

Any chance of something like this making it in before 6.0.0 final? It would be nice to offer full help to Linux users. And to Windows users who elect to set $env:PAGER to a better pager app. :-)

@adityapatwardhan
Copy link
Member

@rkeithhill Sorry for the delay. I will review this today.

@rkeithhill
Copy link
Collaborator Author

No problem. You all had a big push to get beta.9 out.

# On Windows, only display the full help topic if the user has specified a PAGER app.
if (($psCmdlet.ParameterSetName -eq 'AllUsersView') -and !$Full -and (!$IsWindows -or (Test-Path env:PAGER))) {
$PSBoundParameters['Full'] = $true
}
Copy link
Member

Choose a reason for hiding this comment

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

Can we add a test which check the view that gets selected. It should have #FullView

(Get-Help Get-Command -Full).psobject.typenames

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, I can add that.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

BTW, to be clear, this tweak affects only the help function on Linux/macOS/Windows as well as the man alias on Windows. That function pipes through a pager so we don't get rich objects out - just text. That is why I'm using -cmatch to look for certain words that indicate it is full help.

Display full help on Windows systems where user has overriden pager with $env:PAGER.

Fix PowerShell#4962
@vors vors removed their request for review October 28, 2017 06:03
}
}

It "help should not return full view without -Full switch" -Skip:(!$IsWindows) {
Copy link
Member

Choose a reason for hiding this comment

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

Since you already have and after all the Skip should be done over there instead of repeating it in every It.

https://github.com/PowerShell/PowerShell/blob/master/docs/testing-guidelines/WritingPesterTests.md#skipping-tests-in-bulk

}
}

It "help should return full view without -Full switch" -Skip:(!$IsWindows) {
Copy link
Member

Choose a reason for hiding this comment

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

Same comment as above.

Copy link
Member

@adityapatwardhan adityapatwardhan left a comment

Choose a reason for hiding this comment

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

LGTM

@rkeithhill
Copy link
Collaborator Author

I think this is ready to go. The feedback from the @PowerShell/powershell-committee review was implemented in the last commit.

@adityapatwardhan adityapatwardhan changed the title Display full help on non-Windows systems Display full help with 'help' function Nov 6, 2017
@adityapatwardhan adityapatwardhan merged commit c781959 into PowerShell:master Nov 6, 2017
@rkeithhill rkeithhill deleted the rkeithhill/full-help-output branch May 29, 2019 15:21
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.

2 participants