Skip to content

*.Format.ps1xml files are missing (example: FileSystem.Format.ps1xml) #7973

Closed

Description

@JoeSalmeri

Steps to reproduce

help about_format.ps1xml says that the *.format.ps1xml files are located in the $PSHOME directory but the format files are missing from that directory (and do not exist in the entire directory tree)


Expected behavior
-----------------

```none

Actual behavior


Environment data

> $PSVersionTable

`Name                           Value
----                           -----
PSVersion                      6.1.0
PSEdition                      Core
GitCommitId                    6.1.0
OS                             Microsoft Windows 10.0.17763
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Activity

  1. changed the title [-]FileSystem.Format.ps1xml[/-] [+]*.Format.ps1xml files are missing (example: FileSystem.Format.ps1xml)[/+] on Oct 8, 2018
  2. SteveL-MSFT commented on Oct 9, 2018

    @SteveL-MSFT
    Member

    Do you have a need for the ps1xml files? In PowerShell Core 6, the built in formatting are in c# and not in actual ps1xml files. If the concern is the docs are incorrect, we can fix that.

  3. added
    Issue-Discussionthe issue may not have a clear classification yet. The issue may generate an RFC or may be reclassif
    on Oct 9, 2018
  4. JoeSalmeri commented on Oct 9, 2018

    @JoeSalmeri
    Author

    Hi Steve,

    Since the ps1xml files were first released I have modified them to make a some changes.

    With each new PS version I have incorporated my changes into the new files in case anything else
    changed.

    My concern is that the built-in formatting would either add additional changes or possible include
    some of my changes. That's why I merge them into the files each time.

    Here is a summary of the changes I make:

    TableControl
    Reduced LastWriteTime from 25 to 20 to allow some extra space for the next change

    Increased Length from 14 to 15 to allow room for formatting the length to include commas
    
    Modify LastWriteTime formatting to M/dd/yyyy and h:mm:tt so that date and times line up
    better and are easier to read
    
    Modify Length formatting to {0:n0} so that it includes commas 
    (I cannot believe PS has not made this change in all these years, even DOS had commas!)
    

    ListControl
    Modify Length formatting to {0:n0} so that it includes commas

    Modify CreationTime   formatting to M/dd/yyyy and h:mm:tt so that date and times line up
    	(NOTE: 2 places require changing)
    Modify LastWriteTime  formatting to M/dd/yyyy and h:mm:tt so that date and times line up
    	(NOTE: 2 places require changing)
    Modify LastAccessTime formatting to M/dd/yyyy and h:mm:tt so that date and times line up
    	(NOTE: 2 places require changing)
    

    Then I use the following in my profile to incorporate my changes into the PS session

    Update-FormatData -PrependPath My.FileSystem.format.ps1xml
    

    I am happy to send you my files if you are interested in including those changes.

    Thanks!

  5. vexx32 commented on Oct 9, 2018

    @vexx32
    Collaborator

    Steve Lee (@SteveL-MSFT) I would think that at the very least there should be one example / template file, both as a .ps1xml and a .cs file; a good example often speaks much more clearly than several pages of detailed specification. 😕

  6. SteveL-MSFT commented on Oct 9, 2018

    @SteveL-MSFT
    Member

    Joe S (@JoeSalmeri) perhaps you can open a new issue with your specific changes you think should be applied and we can see about making those changes in the product

    Rain Sallow (/u/ta11ow) (@vexx32) long term, I'd like to get away from xml for types and formatting, but that feels a long ways away given everything else we want/need to do. We still have some example ps1xml files in this repo and you can always grab the ones from Windows PowerShell. The default formatters are here

  7. vexx32 commented on Oct 9, 2018

    @vexx32
    Collaborator

    Steve Lee (@SteveL-MSFT) I really can't agree more. I'd love to see Update-FormatData accept direct object input and for the relevant necessary type configuration objects be able to be created in PowerShell directly or created with some kind of hashtable syntax.

  8. JoeSalmeri commented on Oct 17, 2018

    @JoeSalmeri
    Author

    Steve Lee (@SteveL-MSFT)

    Sorry for the delay on my part, I was away do to personal issues.

    I have opened Issue #8060 where I submitted the changes we have been discussing.

    The file included is a copy of the latest FileSystem.Format.ps1xml file with my changes made and includes documentation at the top of what the changes are as well as documentation where each change is made.

    Please let me know if you have any questions and thanks very much for your help and consideration!

  9. felixfbecker commented on Feb 23, 2019

    @felixfbecker
    Contributor

    I was following this tutorial to show stack traces on ErrorRecords. Is it not possible anymore to easily customize printing of built-in objects? If yes that would be sad

  10. vexx32 commented on Feb 23, 2019

    @vexx32
    Collaborator

    Felix Becker (@felixfbecker) you can still do what that tutorial describes. The base format files are in c# now, though, so you'll have to borrow the example file given in the article.

  11. felixfbecker commented on Feb 23, 2019

    @felixfbecker
    Contributor

    Which is based on the format file from 3 years ago.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Discussionthe issue may not have a clear classification yet. The issue may generate an RFC or may be reclassifResolution-AnsweredThe question is answered.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions