Skip to content

Add formatting options to the 'show' and 'user ls' commands - #410

Merged
MichaelMure merged 7 commits into
masterfrom
output-formatting-2
Jun 25, 2020
Merged

MichaelMure merged 7 commits into
masterfrom
output-formatting-2

Conversation

@vincetiu8

@vincetiu8 vincetiu8 commented Jun 23, 2020 •

Copy link
Copy Markdown
Contributor

This PR adds flags to the mentioned commands which allow the user to specify what output format they would like the commands to output in.

In addition, this adds support for a new output flag: org-mode, a format used by emacs users. Hopefully, this improves the functionality of the commands.

Example org-mode outputs:

  • ls:
* 04174ef Open [2020-05-23 18:01:27 +0800 CST] karlicoss (karlicoss): [https://github.com/MichaelMure/git-bug/issues/392][feature: ls dump issues as plaintext (markdown/org-mode)] :[CLI:bridge:enhancement]:
** Last Edited: 2020-06-18 19:59:59 +0800 CST
** Actors:
: 528f341 karlicoss (karlicoss)
: 571aa44 Michael Muré (MichaelMure)
: ff7d2b9 vince
** Participants:
: 528f341 karlicoss (karlicoss)
: 571aa44 Michael Muré (MichaelMure)
: ff7d2b9 vince
  • show:
04174ef [open] feature: ls dump issues as plaintext (markdown/org-mode)
* Author: karlicoss (karlicoss)
* Creation Time: 2020-05-23 18:01:27 +0800 CST
* Last Edit: 2020-06-18 19:59:59 +0800 CST
* Labels:
** CLI
** bridge
** enhancement
* Actors: 
** 528f341 karlicoss (karlicoss)
** 571aa44 Michael Muré (MichaelMure)
** ff7d2b9 vince
* Participants:
** 528f341 karlicoss (karlicoss)
** 571aa44 Michael Muré (MichaelMure)
** ff7d2b9 vince
* Comments:
** #0 karlicoss (karlicoss)
: Basically a command like `git bug dump` that would dump the issues rendered as a single markdown/org-mode file (or a directory of files). This would allow to instantly search in issu
es within the IDE without having to switch to the terminal/web UI.
** #1 Michael Muré (MichaelMure)
: Hoooo, I like this idea of org-mode. I'm not so familiar with it though, could you provide an example with all kind of relevant features ?
:
: Yes, git-bug would benefit from having this kind of export. It has been touched on in #45 and #370.
...
  • user ls:
* 8eec8d4 Glendon Solsberry (gms8994)
* 6310f3a Martin Delille (MartinDelille)
* 92e0130 Alexandre Franke (afranke)
* 23f2a2e Anachron (Anachron)
* 9ddf4dc Tanguy ⧓ Herrmann (dolanor)
* 875fbde Vincent Ambo (tazjin)
* 677a5b5 George Antoniadis (geoah)

This adds options to specify an output format for the commands in question. Supported formats are currently:
- 'plain': plaintext, stripped of all colors
- 'json': prints output as a json object
This adds an option to the formatting flag on the ls, show and user ls commands that allows the user to specify the format of the output in org-mode. This will be useful for emacs users to read it in the editor.
@vincetiu8

Copy link
Copy Markdown
Contributor Author

I have no idea why the builds are failing. Could it be due to my CRLF line endings?

@MichaelMure MichaelMure left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few things to clean but looks good, thanks :)

Comment thread commands/ls.go
Comment thread commands/show.go
Comment thread commands/show.go Outdated
Comment thread commands/show.go Outdated
Comment thread commands/show.go Outdated
Comment thread commands/user_ls.go Outdated
@vincetiu8

Copy link
Copy Markdown
Contributor Author

These comments should all be fixed now @MichaelMure.

This fixes some bugs experienced when using the new formatting options:
- org-mode indents not working properly
- print statements missing contents
@MichaelMure
MichaelMure force-pushed the output-formatting-2 branch from a300008 to 94e2e4c Compare June 24, 2020 12:58
@MichaelMure
MichaelMure force-pushed the output-formatting-2 branch from 94e2e4c to 1d06244 Compare June 24, 2020 13:11
…formats

This assume that the convertion from time.Time <--> Unix timestamp is lossless which seems to be.
@MichaelMure

Copy link
Copy Markdown
Contributor

I took the time to cleanup more things (outside of the scope of this PR most of the time but it was a good occasion).

@MichaelMure
MichaelMure merged commit 2dd0dbb into master Jun 25, 2020
@MichaelMure
MichaelMure deleted the output-formatting-2 branch June 25, 2020 23:02
@karlicoss

karlicoss commented Jul 12, 2020 •

Copy link
Copy Markdown
Contributor

Thanks @Invincibot and @MichaelMure, this is excellent 😍 Sorry it took me so long to try it out, busy days...

There are few org-mode formatting quirks, but I'll submit a PR to fix them!

@karlicoss

Copy link
Copy Markdown
Contributor

@Invincibot I've tried using git show --format org-mode command today to dump out more detailed stats on the bugs -- it works great! But the only unfortunate thing is that it could use a bit more org-mode syntax: e.g. proper TODO state/links/dates/tags, e.g. compare:

# git-bug show output
0c63005 [closed] Make seting up easier
* Author: karlicoss
* Creation Time: 2019-10-15 23:50:57 +0100 BST
* Last Edit: 2020-05-25 01:37:15 +0100 BST
* Labels:
** enhancement
** help wanted
* Actors
...
$ git-bug ls output (partial)
* CLOSED 0c63005 [2019-10-15 Tue 23:57] karlicoss: [[https://github.com/karlicoss/HPI/issues/1][Make seting up easier]] :enhancement:help_wanted:
** Last Edited: [2020-05-25 Mon 01:15]
** Actors:
: 2f4c8c2 karlicoss
: 4584f7e Andrea Ghensi (sanzoghenzo)
** Participants:
: 2f4c8c2 karlicoss
: 4584f7e Andrea Ghensi (sanzoghenzo)

Do you think it would be a good idea to add these? (I can do it, just asking since you were the one who added, so presumably you had some usecase in mind).

My usecase is that I want to run git-bug ls-id | sort | xargs -i git-bug show --format org-mode {} to get a full dump of all issues along with the comments.

karlicoss added a commit to karlicoss/scripts that referenced this pull request Oct 30, 2020
@MichaelMure

Copy link
Copy Markdown
Contributor

@karlicoss yes, definitely possible and welcome to improve this org-mode output. You are the expert here, I'll let you judge what make sense.

@vincetiu8

Copy link
Copy Markdown
Contributor Author

I agree with @MichaelMure, would be really glad for you to implement the org-mode formatting as I don't personally use it myself.

@karlicoss

Copy link
Copy Markdown
Contributor

Oh @Invincibot I'll do it! I just asked since you have added the support for org-mode output in this PR :)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants