Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Show usage (short) help if command line parameter is wrong#5780

Merged
iSazonov merged 2 commits into
PowerShell:masterPowerShell/PowerShell:masterfrom
iSazonov:add-short-helpiSazonov/PowerShell:add-short-helpCopy head branch name to clipboard
Jan 5, 2018
Merged

Show usage (short) help if command line parameter is wrong#5780
iSazonov merged 2 commits into
PowerShell:masterPowerShell/PowerShell:masterfrom
iSazonov:add-short-helpiSazonov/PowerShell:add-short-helpCopy head branch name to clipboard

Conversation

@iSazonov

@iSazonov iSazonov commented Jan 3, 2018

Copy link
Copy Markdown
Collaborator

PR Summary

Close #4986

  • Show short help after an error message:
pwsh.exe -hhhhhhh
The argument '-hhhhhhh' is not recognized as the name of a script file. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

Usage: pwsh[.exe] [[-File] <filePath> [args]]
                  [-Command { - | <script-block> [-args <arg-array>]
                                | <string> [<CommandParameters>] } ]
                  [-ConfigurationName <string>] [-EncodedCommand <Base64EncodedCommand>]
                  [-ExecutionPolicy <ExecutionPolicy>] [-InputFormat {Text | XML}]
                  [-Interactive] [-NoExit] [-NoLogo] [-NonInteractive] [-NoProfile]
                  [-OutputFormat {Text | XML}] [-Version] [-WindowStyle <style>]

       pwsh[.exe] -h | -Help | -? | /?

PowerShell Online Help https://aka.ms/pscore6-docs

All parameters are case-insensitive.
  • Show full help message with pwsh -h

PR Checklist

Note: Please mark anything not applicable to this PR NA.

@iSazonov

iSazonov commented Jan 3, 2018

Copy link
Copy Markdown
Collaborator Author

CI AppVeyor temporary failed.


https://aka.ms/pscore6-docs
Type 'help' to get help.</value>
</data>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't like that we have a copy of the syntax. If we make updates in the future, we need to manually ensure that both sections are updated. Perhaps we can have the syntax (aka short help) just called HelpSyntax and the other one called ExtendedHelp. Now change the code where full help would have been shown shows HelpSyntax followed by ExtendedHelp.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

If ExtendedHelp maybe second - UsageHelp or ShortHelp?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

UsageHelp sounds fine to me

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed.

_hostUI.Write(_helpText);
if (_showExtendedHelp)
{
_hostUI.Write(ManagedEntranceStrings.ExtendedHelp);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Shouldn't this show both UsageHelp and ExtendedHelp?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Line 396 already show UsageHelp.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Got it!

@iSazonov iSazonov merged commit aaa567c into PowerShell:master Jan 5, 2018
@iSazonov iSazonov changed the title Show short help if command line parameter is wrong Show usage (short) help if command line parameter is wrong Jan 5, 2018
@iSazonov iSazonov deleted the add-short-help branch January 5, 2018 18:56
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.

Enhance PowerShell full command line help

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.