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

Show dashes in help #100

Open
robrich opened this issue May 15, 2018 · 1 comment
Open

Show dashes in help #100

robrich opened this issue May 15, 2018 · 1 comment

Comments

@robrich
Copy link

robrich commented May 15, 2018

Help doesn't make it obvious that the user needs to include dashes when passing options.

I was working with a novice user with one of my command-line apps. He passed in nothing, it correctly displayed the help:

b:big   This option makes it bigger
l:little  This option makes it smaller

(not the real options)

So he called myapp.exe b foo l bar and it happily did nothing.

Showing help like this would make it more obvious:

-b --big   This option makes it bigger
-l --little  This option makes it smaller

Would you accept a PR to change the help to this format?

@InteXX
Copy link

InteXX commented Mar 25, 2019

I found a temporary workaround for this:

Sub Main
  ...
  oParser.SetupHelp("?", "help").Callback(GetHelp(oParser.Options))
End Main

Public Function GetHelp(Options As List(Of ICommandLineOption)) As Action(Of String)
  Dim oBuilder As StringBuilder
  Dim oOption As ICommandLineOption
  Dim sUsage As String

  Return Sub(Usage)
           oBuilder = New StringBuilder
           oOption = Options.First

           oBuilder.AppendLine($"Backup [(/{oOption.ShortName} | /{oOption.LongName}):JobName]")
           oBuilder.AppendLine()
           oBuilder.AppendLine("This argument is optional. If it isn't provided, the configuration window is displayed.")

           sUsage = oBuilder.ToString

           MessageBox.Show(sUsage, "Usage", MessageBoxButtons.OK, MessageBoxIcon.None)
         End Sub
End Function

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

No branches or pull requests

2 participants