Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cli/container: Pretty-print creation timestamp in list-objects output #2653

Merged
merged 1 commit into from
Nov 22, 2023

Conversation

cthulhu-rider
Copy link
Contributor

Previously, container list-object command with --with-attr flag printed objects' attributes in raw way. In particular, creation timestamp was showed in Unix format (e.g. 1692609422). While this format is widely known, its human-unreadable. To facilitate the user's experience, the output should be supplemented with a readable format similar to the object head command.

Use Go time.Time stringer and print the result along with Unix time value. From:

HKupeALCqk3VUSmuRXTGdJt6ZZQoJsJ3VtNVV8Pu1Xjd
  Timestamp=1692609422

to:

HKupeALCqk3VUSmuRXTGdJt6ZZQoJsJ3VtNVV8Pu1Xjd
  Timestamp=1692609422 (2023-08-21 11:17:02 +0200 CEST)

Copy link
Member

@carpawell carpawell left a comment

Choose a reason for hiding this comment

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

Think CHANGELOG would be appreciated.

cmd/neofs-cli/modules/container/list_objects.go Outdated Show resolved Hide resolved
cmd/neofs-cli/modules/container/list_objects.go Outdated Show resolved Hide resolved
@roman-khimov
Copy link
Member

It's somewhat dangerous in that it's hard to separate real attribute value from its representation. I'd say we need some --raw flag and clear documentation for possible replacements as well.

Previously, `container list-object` command with `--with-attr` flag
printed objects' attributes in raw way. In particular, creation
timestamp was showed in Unix format (e.g. 1692609422). While this format
is widely known, its human-unreadable. To facilitate the user's
experience, the output should be supplemented with a readable format
similar to the `object head` command.

Use Go `time.Time` stringer and print the result along with Unix time
value. From:
```
HKupeALCqk3VUSmuRXTGdJt6ZZQoJsJ3VtNVV8Pu1Xjd
  Timestamp=1692609422
```
to:
```
HKupeALCqk3VUSmuRXTGdJt6ZZQoJsJ3VtNVV8Pu1Xjd
  Timestamp=1692609422 (2023-08-21 11:17:02 +0200 CEST)
```

Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
Copy link

codecov bot commented Nov 20, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (8d9a2bc) 30.62% compared to head (7053d05) 30.62%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2653   +/-   ##
=======================================
  Coverage   30.62%   30.62%           
=======================================
  Files         406      406           
  Lines       30070    30070           
=======================================
  Hits         9208     9208           
  Misses      20085    20085           
  Partials      777      777           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@cthulhu-rider
Copy link
Contributor Author

cthulhu-rider commented Nov 20, 2023

It's somewhat dangerous in that it's hard to separate real attribute value from its representation. I'd say we need some --raw flag and clear documentation for possible replacements as well.

didnt got ur point why do we need --raw. We print source value and result of parse attempt. If parse fails, we print Timestamp: not_time (malformed)

@cthulhu-rider
Copy link
Contributor Author

It's somewhat dangerous in that it's hard to separate real attribute value from its representation. I'd say we need some --raw flag and clear documentation for possible replacements as well.

didnt got ur point why do we need --raw. We print source value and result of parse attempt. If parse fails, we print Timestamp: not_time (malformed)

oh, i guess u talk about value collisions. Dont think it's a problem for timestamps in practice. More flags is usage complication imo, so i suggest to leave it like this cuz nobody hurts

Copy link
Member

@roman-khimov roman-khimov left a comment

Choose a reason for hiding this comment

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

Given that we're already doing it for object head, OK.

@roman-khimov roman-khimov merged commit 42cf34f into master Nov 22, 2023
11 checks passed
@roman-khimov roman-khimov deleted the cli-list-object-timestamp branch November 22, 2023 09:57
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