data-preservation-programs / singularity

Tool for onboarding data to the Filecoin Network
Other
18 stars 16 forks source link

[Feature Request]: add --terse option to output of commands #197

Closed distora-w3 closed 1 year ago

distora-w3 commented 1 year ago

What is the problem you're trying to solve?

Commands provide wide column output, the output can wrap around and make difficult to view singularity dataset list-pieces test-03

 singularity dataset list-pieces test-03
2023-08-11T08:25:36.880Z        INFO    database        database/connstring_cgo.go:26   Opening sqlite database (cgo version)
ID  CreatedAt             PieceCID                                                          PieceSize    RootCID                                                      FileSize  FilePath                                                                                              DatasetID  SourceID  ChunkID
5   2023-08-08 11:45:23Z  baga6ea4seaqo6lglowozerdb445rmakkilmp5ufsily5mcv4lhts7edffxzb2jy  34359738368  bafkreibzlk4akf7hxry5fziky6lif5svxt5q2hvltrnop42xajlqn422am  273       /mnt/blockstorage/03-test-out/baga6ea4seaqo6lglowozerdb445rmakkilmp5ufsily5mcv4lhts7edffxzb2jy.car    3          3         3
6   2023-08-08 11:55:12Z  baga6ea4seaqhzttjcqkngza5xipx5fq23xujttu2v2rzb3ae47g5wpzxa5ph6gy  34359738368  bafkreieu5n7elcpms5sk63ffdmptxxy5kmhobf66vnduzvtkjmcljxchfy  293       /mnt/blockstorage/03-test-out/baga6ea4seaqhzttjcqkngza5xipx5fq23xujttu2v2rzb3ae47g5wpzxa5ph6gy.car    3          3
7   2023-08-09 08:36:05Z  baga6ea4seaqbwq6rms6666ibag45q55sabsdynoctftitw35snumsho2v5tqydq  34359738368  bafkreibzlk4akf7hxry5fziky6lif5svxt5q2hvltrnop42xajlqn422am  327       /mnt/blockstorage/03-test-out-b/baga6ea4seaqbwq6rms6666ibag45q55sabsdynoctftitw35snumsho2v5tqydq.car  3          4         4

Describe the workaround you currently have

Set font settings to very small and stretch console window as widely as possible

Describe the feature you'd like

adding option such as --terse could be used to reduce output for long strings as in examples below. Alternatively, the short form could be the default with --long providing full output

FROM: bafkreibzlk4akf7hxry5fziky6lif5svxt5q2hvltrnop42xajlqn422am /mnt/blockstorage/03-test-out-b/baga6ea4seaqbwq6rms6666ibag45q55sabsdynoctftitw35snumsho2v5tqydq.car

TO: bafkreib....qn422am /mnt/blockstorage/03-test-out-b/baga6ea....tqydq.car

Additional context

Other examples

$ singularity datasource inspect path 3
2023-08-11T08:35:23.047Z        INFO    database        database/connstring_cgo.go:26   Opening sqlite database (cgo version)
Current Directory:
ID  UpdatedAt             CID                                                          SourceID  Name                          ParentID  Exported
3   2023-08-08 11:55:12Z  bafybeieu5n7elcpms5sk63ffdmptxxy5kmhobf66vnduzvtkjmcljxchfy  3         /mnt/blockstorage/03-test-in            true

SubItems:
ID  CreatedAt             CID                                                          SourceID  Path  Hash  Size  LastModifiedTimestampNano  DirectoryID
3   2023-08-08 11:45:23Z  bafkreibzlk4akf7hxry5fziky6lif5svxt5q2hvltrnop42xajlqn422am  3         foo1        15    1691494933892425589        3
4   2023-08-08 11:45:23Z  bafkreidyw3ashwito5cpacrdsot65u5uq3ote2usplsnyfktsjb63x3dne  3         foo2        17    1691494947432395891        3
5   2023-08-08 11:45:23Z  bafkreibopu4jtea2flahknznbxpz27dxljdujxmi7jgofa5libq627uc5a  3         foo3        17    1691494991252301841        3
6   2023-08-08 11:45:23Z  bafkreihbkcgsn72xcuvrelj7viskczttm6m3suffg3ifrscwmv5cnxvzge  3         foo4        17    1691494974572337281        3
$ singularity datasource inspect dags 3
2023-08-11T08:38:53.703Z        INFO    database        database/connstring_cgo.go:26   Opening sqlite database (cgo version)
ID  CreatedAt             PieceCID                                                          PieceSize    RootCID                                                      FileSize  FilePath                                                                                            DatasetID  SourceID  ChunkID
6   2023-08-08 11:55:12Z  baga6ea4seaqhzttjcqkngza5xipx5fq23xujttu2v2rzb3ae47g5wpzxa5ph6gy  34359738368  bafkreieu5n7elcpms5sk63ffdmptxxy5kmhobf66vnduzvtkjmcljxchfy  293       /mnt/blockstorage/03-test-out/baga6ea4seaqhzttjcqkngza5xipx5fq23xujttu2v2rzb3ae47g5wpzxa5ph6gy.car  3          3
xinaxu commented 1 year ago

How about make terse as default and add --verbose to view all columns?

distora-w3 commented 1 year ago

:) Yes that would work. Thanks.

xinaxu commented 1 year ago

This is addressed in #221