DavidSpickett wrote:

> But not to sure how to add it to help plugin save-core because help files are 
> all static and this help is dynamically generated.

To repeat a comment from the issue, this is what ninja does for example:
```
  -d MODE  enable debugging (use '-d list' to list modes)
  -t TOOL  run a subtool (use '-t list' to list subtools)
    terminates toplevel options; further flags are passed to the tool
  -w FLAG  adjust warnings (use '-w list' to list warnings)
$ ninja check-flang-rt -d list
debugging modes:
  stats        print operation counts/timing info
  explain      explain what caused a command to execute
  keepdepfile  don't delete depfiles after they're read by ninja
  keeprsp      don't delete @response files on success
multiple modes can be enabled via -d FOO -d BAR
```
So their help text is static but `-d list` might show more or less things 
depending on what they add to ninja.

Now the cheapest way to do this is to say in the help: `(use --plugin-name=list 
to list possible plugins)`

And this will be an error because there's no "list" plugin, but you get the 
list of valid plugins so it's the same result for the user. Or you can special 
case "list" such that it's not an error, the only difference is the return 
status and the first line of the output.

Looking at this code, the point where you check the name is quite buried. If it 
were up in the process save-core command then it would be easier. I assume it's 
done this way because you can reach the code via the API as well, so I 
understand the decision.

You could do a special check earlier in the command but it's a lot of effort 
for the same user experience. I'm happy to overlook that it's technically an 
error to list the valid values.

So:
* Add to the help text some static string like those above.
* Use a name like list or help that's never going to be a valid plugin name.
* No one will care that it's an error because now they know what name to use :)

https://github.com/llvm/llvm-project/pull/143126
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to