Skip to content

Conversation

@iSazonov
Copy link
Collaborator

@iSazonov iSazonov commented Jan 3, 2018

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
Copy link
Collaborator Author

iSazonov commented Jan 3, 2018

CI AppVeyor temporary failed.


https://aka.ms/pscore6-docs
Type 'help' to get help.</value>
</data>
Copy link
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
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
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
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
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
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
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