Keyboard shortcuts

Press or to navigate between chapters

Press ? to show this help

Press Esc to hide this help

The time duration flag type

The time duration flag type is a custom flag type that allows you to specify a duration of time, for example specifying the expiry time on a newly created poll or how long you want to mute an account for. The time duration flag takes a string input and converts it into a duration of time. An example string input can be something like “3 days, 12 hours and 39 minutes” which the flag will convert into a time duration of 304,740 seconds. The time duration flag type can convert units in days, hours, minutes and seconds.

There are simple rules to follow to ensure that your input is converted correctly, such as:

  • The string input must be wrapped in quotes.
  • Use the keyword day or days to specify the number of days.
  • Use the keyword hour or hours to specify the number of hours.
  • Use the keyword minute or minutes to specify the number of minutes.
  • Use the keyword second or seconds to specify the number of seconds.
  • There must be at least one space between the quantity and the unit of time.
    For example "7 days" is a valid input but "7days" is invalid.

Examples of valid string inputs

  • "3 days"
  • "6 hours, 45 minutes and 1 second"
  • "1 day, 15 hours 31 minutes and 12 seconds"
  • "(7 days) (1 hour) (21 minutes) (35 seconds)"

Example operations

  • Mute an account for 30 minutes.
    enbas mute account --account-name @bob@gts.social.example --duration "30 minutes"
    
  • Create a poll that will expire in 12 and a half days.
    enbas create status --content-type plain \
        --visibility public \
        --content "Vim or Emacs" \
        --add-poll \
        --poll-option vim \
        --poll-option emacs \
        --poll-expires-in "12 days and 12 hours"
    
  • Expire an existing filter in 1 hour.
    enbas edit filter --filter-id 01VZMFZ3KNGMWBX4HXGOCSJMQXFB4PGH \
        --filter-expires-in "1 hour"