-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Use duration for --debounce-ms in watch #16178
Copy link
Copy link
Closed
Labels
A:datetime-handlingSemantics and implementation of the datetime/duration types and commandsSemantics and implementation of the datetime/duration types and commandscategory:enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers
Milestone
Description
Related problem
Currently, watch uses an int to define the --debounce-ms.
Describe the solution you'd like
Since nu already has a builtin duration type, this would perhaps better fit the use case. It would make for a more consistent and flexible CLI:
watch --debounce 5min . { "Something changed" | print }Describe alternatives you've considered
You could manually convert the time to ms before calling watch:
watch . --debounce-ms ((5min / 1ms) | math round) { "Something changed" | print }Additional context and details
If this is implemented, we need to add watch to the list of commands using Duration in the docs:
- https://www.nushell.sh/lang-guide/chapters/types/basic_types/duration.html#common-commands-that-can-be-used-with-duration
- https://github.com/nushell/nushell.github.io/blob/95ed663728798931178c1b2abe3fbd339149fb06/lang-guide/chapters/types/basic_types/duration.md?plain=1#L41
Also, if this is implemented, we need to think about deprecation. Do we remove the old flag entirely? this would break many existing scripts. Do we instead keep the old flag and simply add a new one? Imo the best option.
And how do we handle the short flag -d?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A:datetime-handlingSemantics and implementation of the datetime/duration types and commandsSemantics and implementation of the datetime/duration types and commandscategory:enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers