Skip to content

Default format #27

Open
Open
@felixfbecker

Description

@felixfbecker

The current default format is pretty unreadable for use in the PowerShell REPL:

✔ ~
🍺  Get-GitHubIssueForRepository PowerShell/PowerShellForGitHub | Select-Object -First 1
Getting issues for repository PowerShell/PowerShellForGitHub
                                                                                                                                                                                                                                                                                                                                                                                  url                : https://github.com/api/repos/PowerShell/PowerShellForGitHub/issues/26                                                                                               repository_url     : https://github.com/api/repos/PowerShell/PowerShellForGitHub                                                                                                         
labels_url         : https://github.com/api/repos/PowerShell/PowerShellForGitHub/issues/26/labels{/name}
comments_url       : https://github.com/api/repos/PowerShell/PowerShellForGitHub/issues/26/comments
events_url         : https://github.com/api/repos/PowerShell/PowerShellForGitHub/issues/26/events
html_url           : https://github.com/PowerShell/PowerShellForGitHub/issues/26
id                 : 301194116
number             : 26
title              : Token in template file
user               : @{login=felixfbecker; id=10532611; avatar_url=https://avatars0.githubusercontent.com/u/10532611?v=4; gravatar_id=; url=https://github.com/api/users/felixfbecker; h
                     tml_url=https://github.com/felixfbecker; followers_url=https://github.com/api/users/felixfbecker/followers; following_url=https://github.com/api/users/felixfbecker
                     /following{/other_user}; gists_url=https://github.com/api/users/felixfbecker/gists{/gist_id}; starred_url=https://github.com/api/users/felixfbecker/starred{/owner}
                     {/repo}; subscriptions_url=https://github.com/api/users/felixfbecker/subscriptions; organizations_url=https://github.com/api/users/felixfbecker/orgs; repos_url=htt
                     ps://api.github.com/users/felixfbecker/repos; events_url=https://github.com/api/users/felixfbecker/events{/privacy}; received_events_url=https://github.com/api/use
                     rs/felixfbecker/received_events; type=User; site_admin=False}
labels             : {}
state              : open
locked             : False
assignee           : 
assignees          : {}
milestone          : 
comments           : 0
created_at         : 02/28/2018 21:41:52
updated_at         : 02/28/2018 21:41:52
closed_at          : 
author_association : NONE
body               : I find it weird having to rename a file in the module and setting the token there. Wouldn't this get overridden on updates? Why can't I just set the token in profi
                     le.ps1?
                     
                     And, shouldn't this be a secure string or credential object of some sort instead of a plain string?

Table format shows mostly unimportant data:

✔ ~
🍺  Get-GitHubIssueForRepository PowerShell/PowerShellForGitHub  | Format-Table
Getting issues for repository PowerShell/PowerShellForGitHub
                                                                                                                                                                                                                                                                                                      url                                                                   repository_url                                              labels_url                                                                          comments_url                                                                    ---                                                                   --------------                                              ----------                                                                          ------------                                                                    https://github.com/api/repos/PowerShell/PowerShellForGitHub/issues/26 https://github.com/api/repos/PowerShell/PowerShellForGitHub https://github.com/api/repos/PowerShell/PowerShellForGitHub/issues/26/labels{/name} https://github.com/api/repos/PowerShell/PowerShellForGitHub/issues/26/comments  
https://github.com/api/repos/PowerShell/PowerShellForGitHub/issues/24 https://github.com/api/repos/PowerShell/PowerShellForGitHub https://github.com/api/repos/PowerShell/PowerShellForGitHub/issues/24/labels{/name} https://github.com/api/repos/PowerShell/PowerShellForGitHub/issues/24/comments
https://github.com/api/repos/PowerShell/PowerShellForGitHub/issues/23 https://github.com/api/repos/PowerShell/PowerShellForGitHub https://github.com/api/repos/PowerShell/PowerShellForGitHub/issues/23/labels{/name} https://github.com/api/repos/PowerShell/PowerShellForGitHub/issues/23/comments
https://github.com/api/repos/PowerShell/PowerShellForGitHub/issues/21 https://github.com/api/repos/PowerShell/PowerShellForGitHub https://github.com/api/repos/PowerShell/PowerShellForGitHub/issues/21/labels{/name} https://github.com/api/repos/PowerShell/PowerShellForGitHub/issues/21/comments

I would propose to add ps1xml format files so that the default output format is a table that somewhat resembles the information GitHub shows on the issues page (title, author, closed/open, labels, ...).

https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_format.ps1xml?view=powershell-6

Activity

HowardWolosky

HowardWolosky commented on Nov 13, 2018

@HowardWolosky
Contributor

Thanks for the suggestion, Felix. Do you have any interest in authoring some ps1xml files for the module?

added
up for grabsAnyone in the community is welcome to do this work
help wantedAnyone in the community is welcome to do this work
enhancementAn issue or pull request introducing new functionality to the project.
on Nov 30, 2018
wightsci

wightsci commented on May 21, 2020

@wightsci

I was having a look at this because I was looking for an easy way to help.
I think that the PSCustomObjects that the cmdlets output need to be tagged for Format.ps1xml to be able to be applied. I'm happy to help with the XML wrangling if the objects are tagged.

X-Guardian

X-Guardian commented on May 31, 2020

@X-Guardian
Contributor

I've raised PR #205 which adds output types and views for the GitHubRepositories module. This should give you the pattern to add types and views to the other modules.

felixfbecker

felixfbecker commented on May 31, 2020

@felixfbecker
Author

I've since focused my efforts on PSGitHub instead, see the README for screenshots of the pretty formatting: https://github.com/pcgeek86/PSGitHub#pretty-formatting

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

    enhancementAn issue or pull request introducing new functionality to the project.help wantedAnyone in the community is welcome to do this workup for grabsAnyone in the community is welcome to do this work

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @felixfbecker@wightsci@HowardWolosky@X-Guardian

        Issue actions

          Default format · Issue #27 · microsoft/PowerShellForGitHub