mirror of https://github.com/Hoffelhas/autodoist
Added modes check and CLI output as additional feedback during initialising
parent
9c947b7292
commit
b2430dcb1e
24
autodoist.py
24
autodoist.py
|
@ -33,7 +33,8 @@ def main():
|
||||||
"""Main process function."""
|
"""Main process function."""
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
formatter_class=make_wide(argparse.HelpFormatter, w=110, h=50))
|
formatter_class=make_wide(argparse.HelpFormatter, w=110, h=50))
|
||||||
parser.add_argument('-a', '--api_key', help='Takes your Todoist API Key.', type=str)
|
parser.add_argument('-a', '--api_key',
|
||||||
|
help='Takes your Todoist API Key.', type=str)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'-l', '--label', help='Enable next action labelling. Define which label to use.', type=str)
|
'-l', '--label', help='Enable next action labelling. Define which label to use.', type=str)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
|
@ -46,7 +47,7 @@ def main():
|
||||||
'-ps', '--p_suffix', help='Change suffix for parallel labeling (default "//").', default='//')
|
'-ps', '--p_suffix', help='Change suffix for parallel labeling (default "//").', default='//')
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'-ss', '--s_suffix', help='Change suffix for sequential labeling (default "--").', default='--')
|
'-ss', '--s_suffix', help='Change suffix for sequential labeling (default "--").', default='--')
|
||||||
parser.add_argument('-hf', '--hide_future', help='Hide future dated next actions until the specified number of days (default 7).',
|
parser.add_argument('-hf', '--hide_future', help='Skip labelling future tasks after the specified number of days (default 7).',
|
||||||
default=7, type=int)
|
default=7, type=int)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--onetime', help='Update Todoist once and exit.', action='store_true')
|
'--onetime', help='Update Todoist once and exit.', action='store_true')
|
||||||
|
@ -54,7 +55,7 @@ def main():
|
||||||
'--nocache', help='Disables caching data to disk for quicker syncing.', action='store_true')
|
'--nocache', help='Disables caching data to disk for quicker syncing.', action='store_true')
|
||||||
parser.add_argument('--debug', help='Enable detailed debugging in log.',
|
parser.add_argument('--debug', help='Enable detailed debugging in log.',
|
||||||
action='store_true')
|
action='store_true')
|
||||||
parser.add_argument('--inbox', help='The method the Inbox should be processed.',
|
parser.add_argument('--inbox', help='The method the Inbox should be processed with.',
|
||||||
default=None, choices=['parallel', 'sequential'])
|
default=None, choices=['parallel', 'sequential'])
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
@ -98,6 +99,22 @@ def main():
|
||||||
else:
|
else:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
# Show which modes are enabled:
|
||||||
|
modes = []
|
||||||
|
m_num = 0
|
||||||
|
for x in [args.label, args.recurring, args.end]:
|
||||||
|
if x:
|
||||||
|
modes.append('Enabled')
|
||||||
|
m_num += 1
|
||||||
|
else:
|
||||||
|
modes.append('Disabled')
|
||||||
|
|
||||||
|
logging.info("\nYou are running with the following functionalities:\n\n Next action labelling mode: {}\n Regenerate sub-tasks mode: {}\n Shifted end-of-day mode: {}\n".format(*modes))
|
||||||
|
|
||||||
|
if m_num == 0:
|
||||||
|
logging.info("\n No functionality has been enabled. Please see --help for the available options.\n")
|
||||||
|
exit(0)
|
||||||
|
|
||||||
# Run the initial sync
|
# Run the initial sync
|
||||||
logging.debug('Connecting to the Todoist API')
|
logging.debug('Connecting to the Todoist API')
|
||||||
|
|
||||||
|
@ -506,5 +523,6 @@ def main():
|
||||||
logging.debug('Sleeping for %d seconds', args.delay)
|
logging.debug('Sleeping for %d seconds', args.delay)
|
||||||
time.sleep(args.delay)
|
time.sleep(args.delay)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
Loading…
Reference in New Issue