habitmove/run.py

35 lines
672 B
Python
Executable file

#!/usr/bin/env python
import habitmove.schema as schema
import habitmove.habits as habits
import habitmove.repetitions as rep
import habitmove.nomie as nomie
import sys
def migrate(trackers, events):
db = schema.migrate("output.db")
if trackers is not None:
habitlist = habits.migrate(db, trackers)
if events is not None:
rep.migrate(db, habitlist, events)
db.commit()
db.close()
def main():
file = sys.argv[1]
data = nomie.get_data(file, True)
migrate(data["trackers"], data["events"])
if __name__ == "__main__":
main()
# things to have as (data) classes:
# tracker, event, tag?
# habit, repetition