def main( period: str = typer.Option("2103", prompt="YYMM"), management_folder: Path = typer.Option('/Users/z/Dropbox\ \(MBJ\)/mbj/management', prompt="Dropbox Management path") ) -> None: assert int(period) , "Period should be of the form yymm" yy = period[:2] yyyy = f"20{yy}" mm = period[2:4] path = Path(management_folder / yyyy / 'salary' / f'{yyyy}-{mm}' / '_share' ) console.print(path) if not os.path.exists(path): os.makedirs(path) with open(os.path.join(path, f'{period} summary places.txt'), "w") as f: f.write(f'Name\tWhere\tDays\n') n = "" for item in get_hours_user_place(period): if n != item[0]: n = item[0] # f.write("\n") f.write(f'{n}\t{item[1]}\t{item[2]}\n') print_summary(period, path, UIDS) print_timesheets(period, path, UIDS)
def main(period: str = typer.Option("2103", prompt="YYMM"), management_folder: Path = typer.Option( '/Users/z/Dropbox (MBJ)/mbj/management', prompt="Dropbox Management path")) -> None: assert int(period), "Period should be of the form yymm" yy = period[:2] yyyy = f"20{yy}" mm = period[2:4] path = Path(management_folder / yyyy / 'salary' / f'{yyyy}-{mm}' / '_share') console.print(path) path.mkdir(parents=True, exist_ok=True) if True: with open(Path(path) / f'{period} summary places.txt', "w") as f: f.write(f'Name\tWhere\tDays\n') n = "" for item in get_hours_user_place(year=int(yyyy), month=int(mm)): if n != item[0]: n = item[0] # f.write("\n") f.write(f'{n}\t{item[1]}\t{item[2]}\n') print_summary(period, path, UIDS)
def main(period: str, path: str) -> None: """ Prints timesheets in specified PATH (-p) for specific period (-m) YYYY-MM example: ts -m 2020-09 -p "/Users/z/Dropbox (MBJ)/ab/dev/run/timesheet" """ assert int(period[:4]) and int( period[5:]), "Period should be of the form yyyy-mm" if path == None: path = os.path.dirname(os.path.realpath(__file__)) if not os.path.exists(path): os.makedirs(path) with open(os.path.join(path, f'{period} summary places.txt'), "w") as f: f.write(f'Name\tWhere\tDays\n') n = "" for item in get_hours_user_place(period): if n != item[0]: n = item[0] # f.write("\n") f.write(f'{n}\t{item[1]}\t{item[2]}\n') print_summary(period, path, UIDS) print_timesheets(period, path, UIDS)