azure-powershell icon indicating copy to clipboard operation
azure-powershell copied to clipboard

Create tool to generate format.ps1xml file

Open cormacpayne opened this issue 9 years ago • 7 comments

Currently there is no way to create a format.ps1xml file without copying an existing file and changing the types and properties.

The cmdlet should go in the Repo-Tasks module: https://github.com/Azure/azure-powershell/blob/preview/tools/Repo-Tasks.psd1

There should be a tool that accepts the .dll for a module and does the following:

  • [ ] By default, creates a list and table view for each output type that displays all of their properties
  • [ ] Suggest a mechsnism (config, attributes, etc) for the user to specify properties to include or exclude, and potentially for custom formatting
  • [ ] Allow users to specify a module, and optionally an output path and a list of cmdlets

Documentation on ps1xml files:https://msdn.microsoft.com/en-us/library/gg580922(v=vs.85).aspx

Sample ps1xml files: https://github.com/Azure/azure-powershell/blob/preview/src/ResourceManager/Profile/Commands.Profile/Microsoft.Azure.Commands.Profile.format.ps1xml

Documentation is needed for this topic as there is very little one how this file works. The documentation should include the following:

  • [ ] How a format.ps1xml file is structured
  • [ ] The difference between list and table view, and when one should be used versus the other

cormacpayne avatar Aug 28 '17 17:08 cormacpayne

Sample of generated list format: https://github.com/Azure/azure-powershell/blob/preview/src/ResourceManager/Profile/Commands.Profile/Microsoft.Azure.Commands.Profile.format.ps1xml#L93-L118

Documents about formatting: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_format.ps1xml?view=powershell-5.1 https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/update-formatdata?view=powershell-5.1

markcowl avatar Feb 02 '18 19:02 markcowl

Sample table format: https://github.com/Azure/azure-powershell/blob/preview/src/ResourceManager/Compute/Commands.Compute/Microsoft.Azure.Commands.Compute.format.generated.ps1xml#L88-L145

markcowl avatar Feb 02 '18 19:02 markcowl

Related issue here: https://github.com/Azure/azure-powershell/issues/865

cormacpayne avatar Feb 07 '18 01:02 cormacpayne

Quickly use/test cmdlet from VS._

Debug/Start Action/Start external program: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe Debug/Start Options/Command line arguments: -NoProfile -NoExit -Command "Import-Module .\RepoTasks.Cmdlets.dll

image

vladimir-shcherbakov avatar Feb 27 '18 19:02 vladimir-shcherbakov

https://github.com/Azure/azure-powershell/pull/5559

vladimir-shcherbakov avatar Mar 02 '18 00:03 vladimir-shcherbakov

https://github.com/Azure/azure-powershell/pull/5666

vladimir-shcherbakov avatar Mar 30 '18 19:03 vladimir-shcherbakov

PR merged - closing.

vladimir-shcherbakov avatar Mar 30 '18 19:03 vladimir-shcherbakov