Skip to content

Use duration for --debounce-ms in watch #16178

@lucascherzer

Description

@lucascherzer

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:

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    A:datetime-handlingSemantics and implementation of the datetime/duration types and commandscategory:enhancementNew feature or requestgood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions