Wait Flag
smhmd opened this issue · comments
Is your feature request related to a problem? Please describe.
blocking websites to work, I sometimes need to use a website for a limited amount of time to not sidetrack. Do you think it would be useful to add a time flag?
Describe the solution you'd like
$ hostctl enable -p youtube -t 15 # enable youtube profile for 15 minutes
Describe alternatives you've considered
$ hostcl enable -p youtube && sleep 900 && hostctl disable -p youtube
I was thinking on something similar like --wait
to keep the command running and stop on CRTL+c
, but it could also accept a time parameter. I like the idea.
This is implemented on v0.10.0. Thanks for adding this request @smhmd! 🎉
You can use it with this examples:
# enable awesome profile for 30 seconds and then disable it (or until ctrl-c)
hostctl enable -p youtube --wait 30s
# add a new profile with content from a file and disable it after 8 hours (or until ctrl-c)
hostctl add -p dailyblock --from $HOME/block_daily_hosts --wait 8h
# sync with docker-compose services and remove them when ctrl-c is sent
hostctl sync docker-compose --wait 0
@guumaster wait
flag for toggle
command?
@guumaster --wait
without argument to assume 0
?
I've tried that, but with the CLI framework cobra
, AFAIK you can't have a flag with two types (duration or bool), so I've chosen the duration option and that makes the zero mandatory to wait indefinitely.