red-gate / XmlDoc2CmdletDoc

Create cmdlet XML help files from XML doc comments
Other
63 stars 24 forks source link

Explicitly indicate "None" if no items for Inputs or Outputs sections #11

Closed msorens closed 8 years ago

msorens commented 8 years ago

If the Inputs or Outputs section of the help content has no entries, I think it would be much cleaner to add a dummy node in the MAML so that it outputs, e.g. "-None-" or "None". While helpful to both sections, the situation is particularly egregious if the Outputs section is empty (because .NET does not put a header on the Examples section-aarrgh!), currently:

INPUTS
    Data.VersionInfo

OUTPUTS

  ----------  EXAMPLE 1  ----------

So we could at least make it read a bit better:

INPUTS
    Data.VersionInfo

OUTPUTS
    -None-

  ----------  EXAMPLE 1  ----------
ChrisLambrou commented 8 years ago

This could be misleading if a cmdlet doesn't explicitly declare its output type, but it nonetheless does write objects to the pipeline. I think it aids adoption if a user can add XmlDoc2CmdletDoc to their project and it immediately generates useful help files, even without having written any specific XML Doc comments. This proposed change goes against that.

We could emit an output type of None if the output type is explicitly declared as void - i.e. [OutputType(typeof(void))] - but I'm not sure this is all that useful.

msorens commented 8 years ago

You present a good argument against my suggestion, Chris, so I am on board with skipping it. Furthermore, I actually do like your counter-proposal (explicitly declaring void to get "None") because that: (a) gives the user the choice whether to use the feature or not, and (b) promotes completeness in coding, if you will. By that I mean, that it should be a best practice to always specify an output type, otherwise, a reader could always have the question of whether the cmdlet actually has no output or the author simply forgot to specify it. (I have not done this before, but I think I will going forward.)

ChrisLambrou commented 8 years ago

Fixed in 0.2.1.