#!/usr/bin/env python3

import click
import pandas as pd
import os

@click.command()
@click.option('--sep', '-s', type=str, default='\t')
@click.option('--encoding', type=str, default='utf-8')
@click.argument('input_file', type=click.Path(dir_okay=False, readable=True, resolve_path=True))
@click.argument('output_file', type=click.Path(dir_okay=False, writable=True, resolve_path=True), required=False)
def cli(
    input_file,
    output_file,
    encoding,
    sep,
):
    df = pd.read_csv(input_file, sep=sep, header=None, encoding=encoding)
    if output_file is None:
        output_file = ''.join([os.path.splitext(input_file)[0], '.xlsx'])
    df.to_excel(output_file, header=None, index=False)

if __name__ == '__main__':
    cli()
