feat: add --time-format parameter for parse and search commands #104
+189
−17
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Add
--time-formatparameter tomonocle parseandmonocle searchcommands to control how timestamps are displayed in output.Features
--time-format unix(default): Output timestamps as Unix epoch (integer or float)1697043600or1697043600.5--time-format rfc3339: Output timestamps in ISO 8601/RFC3339 format2023-10-11T17:00:00+00:00Usage Examples
Together with
--format tableand--fields timestamp,prefix,as_path, the updated command results can look much cleaner:Backward Compatibility
--time-format unixis the default, maintaining existing output format--time-formatsetting, ensuring backward compatibility for scripts that parse JSON outputImplementation Details
TimestampFormatenum tosrc/lens/utils.rswith variantsUnixandRfc3339elem_format.rsto support timestamp formatting viaget_field_value_with_time_format()--time-formatCLI argument to bothparse.rsandsearch.rscommandsbuild_json_object) continue to usejson!(elem.timestamp)to preserve numeric output