The CLI for Be Productive. This notebook defines the behaviour of beproductive.py when you run it.

main[source]

main(action=None, time=None, break_time=None, pomodoros=None)

Testing main function

Make sure the main functionality works as expected.

main(action='block')
Websites blocked, enjoy your work.
main(action='unblock')
All websites unblocked.
main(action='block', time=1/60)
Websites blocked for 0.016666666666666666 minutes.
All websites unblocked.
main(action='pomodoro', time=1/60, break_time=1/60, pomodoros=2)
Pomodoro no. 1 of 2 started, work for 0.016666666666666666 minutes
Pomodoro no. 1 ended, take a 0.016666666666666666 minutes break
Pomodoro no. 2 of 2 started, work for 0.016666666666666666 minutes
Pomodoro session ended, take a longer break. All websites unblocked.

Command Line Program

Parsing Arguments

parse_arguments[source]

parse_arguments()

Parse arguments from shell. All arguments are optional. action: ['block', 'unblock', 'pomodoro'] time: minutes break_time: minutes pomodoros: int

Returns: Namespace

Little helper function from https://stackoverflow.com/a/22424821

in_notebook[source]

in_notebook()

Returns True if run in a notebook environment.

Execution in CLI