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

Add support for Alias information to cmdlet schema #585

Open
sdwheeler opened this issue Aug 29, 2022 · 7 comments
Open

Add support for Alias information to cmdlet schema #585

sdwheeler opened this issue Aug 29, 2022 · 7 comments
Labels
Area-MarkdownWriter Issue concerns conversion to markdown Area-Yaml Issue concerns conversion to Yaml Issue-Enhancement Issue is more of a feature request than a bug Resolution-Fixed The issue is fixed.
Milestone

Comments

@sdwheeler
Copy link
Collaborator

Summary of the new feature / enhancement

As a user I need an easy way to search for cmdlet reference by the cmdlet alias.

Most cmdlet reference docs do not contain information about cmdlet aliases. If they do mention the alias, there is no standard pattern for documenting the alias. The docs platform does not have a way to search for cmdlets by alias.

Goals

  1. Provide alias information in a way that the docs platform can use it to enhance search
  2. Standardize how cmdlet aliases are documented making the information easier to find by readers and search engines
  3. New-MarkdownHelp should create the empty template information for an author to populate

Proposed technical implementation details (optional)

Add YAML metadata frontmatter to list aliases by platform. For example:

alias:
  - all: dir, gci
  - windows: ls
  - macos:
  - linux:

Add a new H2 section after SYNOPSIS and before SYNTAX for documenting the aliases. For example:

## ALIASES

This cmdlet supports the following aliases on the following platforms:

- All platforms: `dir`, `gci`
- Windows: `ls`

See alias-prototype.md for a more complete example.

@sdwheeler sdwheeler added Area-MarkdownWriter Issue concerns conversion to markdown Area-Yaml Issue concerns conversion to Yaml Issue-Enhancement Issue is more of a feature request than a bug labels Aug 29, 2022
@theJasonHelmick
Copy link
Collaborator

@sdwheeler - Thank you for adding this issue -- I'll get into the spec.

@theJasonHelmick theJasonHelmick added this to the 2.0-Preview2 milestone Aug 30, 2022
@JamesWTruher
Copy link
Contributor

@sdwheeler, @theJasonHelmick
would this be something that is applied automatically? The alias attribute does not support a specific alias for a specific platform (it's just a collection of strings)? FWIW, the number of cmdlets that have a cmdlet alias specified in custom attributes (in current pwsh) is quite small, only 5 out of 1000s

@sdwheeler
Copy link
Collaborator Author

The request here is to support the metadata. It is up to the author to populate the information. This information will be used by the publishing platform.

@JamesWTruher
Copy link
Contributor

JamesWTruher commented Nov 1, 2023

@sdwheeler @theJasonHelmick

is there a reason why the yaml should not look like this:

alias:
  - windows: ls, dir
  - macos: dir
  - linux: dir

The reason is that you likely have the same aliases for macos and linux nearly all the time:

alias:
  - windows: dir
  - macos: ls
  - linux: ls

It seems like do too much to have an all - alternatively, you may want to take this approach:

alias:
  - dir: windows, macos, linux
  - ls: macos, linux

Then you might be able to argue that all could work:

alias:
  - dir: all
  - ls: macos, linux

The object model does not need to look exactly like the markdown (in some cases, that may not be a good idea)

@theJasonHelmick
Copy link
Collaborator

This is included in the Microsoft.PowerShell.PlatyPS 1.0 release.

@sdwheeler
Copy link
Collaborator Author

Reopening. This hasn't been completed yet.

There are two parts to documenting aliases.

  • Part 1 - We need a list of aliases as data that the build pipeline can consume so that it can decorate the TOC with aliases.
    • This list should contain all aliases for the command on all platforms.
    • The list does not need to know which aliases are available on which platforms.
    • The list will be hand authored
    • The list will be in the Yaml frontmatter of the markdown file
  • Part 2 - We need an H2 for ALIASES with arbitrary markdown that describes the aliases.
    • The description will be hand authored.
    • It is up to the author to ensure that the list in the metadata is properly reflected in the markdown description under the H2.
    • PlatyPS will do no validation of the information.

Questions:

  • How should the frontmatter metadata be written? Suggest using a Yaml array of strings similar to the no-loc key that we already use.

    Example:

    aliases: [ dir, gci, ls ]

@JamesWTruher Comments? Suggestions?

@sdwheeler sdwheeler reopened this Jul 11, 2024
@sdwheeler
Copy link
Collaborator Author

It appears that 27d5ffe now supports this format:

aliases: [ dir, gci, ls ]

@sdwheeler sdwheeler added the Resolution-Fixed The issue is fixed. label Aug 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-MarkdownWriter Issue concerns conversion to markdown Area-Yaml Issue concerns conversion to Yaml Issue-Enhancement Issue is more of a feature request than a bug Resolution-Fixed The issue is fixed.
Projects
None yet
Development

No branches or pull requests

3 participants