diff --git a/chaintools_bio/cli.py b/chaintools_bio/cli.py index d2e4c28..8f0e8d2 100644 --- a/chaintools_bio/cli.py +++ b/chaintools_bio/cli.py @@ -18,13 +18,10 @@ stats, ) -app = typer.Typer(help="Utilities for the genomic chain format") - - -def version_callback(value: bool): - if value: - print(f"chaintools_bio version: {__version__}") - raise typer.Exit() +app = typer.Typer( + help="Utilities for the genomic chain format", + no_args_is_help=True, +) class CoordSystem(str, Enum): @@ -87,10 +84,10 @@ def to_sam_cmd( "", "-o", "--output", help="Path to the output SAM file" ), target_fasta: str = typer.Option( - "", "-t", "--target-fasta", help="Path to the target FASTA file" + ..., "-t", "--target-fasta", help="Path to the target FASTA file" ), query_fasta: str = typer.Option( - "", "-q", "--query-fasta", help="Path to the query FASTA file" + ..., "-q", "--query-fasta", help="Path to the query FASTA file" ), ): """Convert a chain file to the SAM format""" @@ -111,10 +108,10 @@ def to_vcf_cmd( "", "-o", "--output", help="Path to the output VCF file" ), target_fasta: str = typer.Option( - "", "-t", "--target-fasta", help="Path to the target FASTA file" + ..., "-t", "--target-fasta", help="Path to the target FASTA file" ), query_fasta: str = typer.Option( - "", "-q", "--query-fasta", help="Path to the query FASTA file" + ..., "-q", "--query-fasta", help="Path to the query FASTA file" ), ): """Convert a chain file to the VCF format""" @@ -163,7 +160,7 @@ def annotate_cmd( "", "-o", "--output", help="Path to the output annotated chain file" ), bed_prefix: str = typer.Option( - ..., "-b", "--bed-prefix", help="Prefix for BED output files" + "", "-b", "--bed-prefix", help="Prefix for BED output files" ), summary: str = typer.Option( "", "-s", "--summary", help="Path to summary output file" @@ -237,12 +234,24 @@ def stats_cmd( stats.stats(fn_chain=chain, fn_out=output) -@app.callback() -def main( +def _version_callback(value: bool): + if value: + print(f"chaintools_bio version: {__version__}") + raise typer.Exit() + + +@app.callback(invoke_without_command=True) +def version_callback( version: bool = typer.Option( - None, "--version", callback=version_callback, is_eager=True + None, "--version", callback=_version_callback, is_eager=True ), ): + pass + + +def main(): + """Primary entry point for the CLI.""" + version_callback() app()