z411 / trackma

Open multi-site list manager for Unix-like systems. (ex-wMAL)
https://z411.github.io/trackma
GNU General Public License v3.0
761 stars 82 forks source link

Option to "list" in a different format (raw data) [feature request] #660

Open RaitaroH opened 1 year ago

RaitaroH commented 1 year ago

Hi,

Thank you for the awesome program. I am heavily using it with my adl script.

I think it would be very helpful, both to me for my adl script, but also others like justchokingaround/trackma-wrapper to allow trackma -a 1 list to output in a different format upon request. What I mean is, by default it shows a table, but for scripting purposes having it in a character delimited format, or even json would be much better.

For example, right now the output looks like this if I copy paste it:

| Index  Title                                           Progress  Score  |
|   1    Blue Lock......................................   9 / 24   5.5   |
|   2    Bocchi the Rock!...............................   9 / 12   6.5   |
|   3    Chainsaw Man...................................   9 / 12   5.5   |
|   4    Do It Yourself!!...............................  10 / 12    6    |
|   5    Isekai Oji-san.................................   9 / 13   6.5   |
|   6    Kyokou Suiri...................................   4 / 12    0    |
|   7    Mairimashita! Iruma-kun 3......................   9 / 21    5    |
|   8    Meitantei Conan................................ 1066 / ?   7.5   |
|   9    SPY×FAMILY Part 2..............................  10 / 13    7    |
|   10   Tensei Shitara Ken Deshita.....................  11 / 12    5    |
|   11   Uchi no Shishou wa Shippo ga Nai...............  10 / 13   6.5   |
11 results

This requires a bit of scripting to clean up and to get anime titles, or to use trackma info index which is slow.

As such I believe that following would be much nicer: trackma -a 1 list raw

1|"Blue Lock"|9|24|5.5
2|"Bocchi the Rock!"|9|12|6.5

This allows for very simple awk -F'|' '{print $n}' type commands.

FichteFoll commented 1 year ago

Separating the fields with a tab (or using JSON, as you mentioned) would be a better approach than a |.

RaitaroH commented 1 year ago

@FichteFoll I made a PR for this. Hopefully it will get accepted.