import pyaxml
import click


@click.command()
@click.argument("input_file")
@click.argument("output_file")
def copy_axml(input_file, output_file):
    filename = input_file
    with open(filename, "rb") as f:
        # Read AXML and get XML object
        axml_object, _ = pyaxml.AXMLGuess.from_axml(f.read())
    # Rewrite the file
    with open(output_file, "wb") as f:
        f.write(axml_object.pack())


if __name__ == "__main__":
    copy_axml()
