forked from mirrors/autodoist
If the given label doesn't exists, a new one is now automatically created!
parent
b2430dcb1e
commit
fa3d7fa1dd
15
autodoist.py
15
autodoist.py
|
@ -109,7 +109,7 @@ def main():
|
||||||
else:
|
else:
|
||||||
modes.append('Disabled')
|
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))
|
logging.info("You 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:
|
if m_num == 0:
|
||||||
logging.info("\n No functionality has been enabled. Please see --help for the available options.\n")
|
logging.info("\n No functionality has been enabled. Please see --help for the available options.\n")
|
||||||
|
@ -137,14 +137,19 @@ def main():
|
||||||
else:
|
else:
|
||||||
# Create a new label in Todoist
|
# Create a new label in Todoist
|
||||||
#TODO:
|
#TODO:
|
||||||
logging.error(
|
logging.info(
|
||||||
"\n\nLabel \'%s\' doesn't exist in your Todoist. Please create it or use your custom label by running Autodoist with the argument '-l <YOUR_EXACT_LABEL>'.\n", args.label)
|
"\n\nLabel '{}' doesn't exist in your Todoist. A new label is now created for you.\n".format(args.label))
|
||||||
sys.exit(1)
|
# sys.exit(1)
|
||||||
|
api.labels.add(args.label)
|
||||||
|
api.commit()
|
||||||
|
api.sync()
|
||||||
|
labels = api.labels.all(lambda x: x['name'] == args.label)
|
||||||
|
label_id = labels[0]['id']
|
||||||
else:
|
else:
|
||||||
# Label functionality not needed
|
# Label functionality not needed
|
||||||
label_id = None
|
label_id = None
|
||||||
|
|
||||||
logging.info("\nAutodoist has connected and is running fine!\n")
|
logging.info("Autodoist has connected and is running fine!\n")
|
||||||
|
|
||||||
return api, label_id
|
return api, label_id
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue