---
title: "Document how to provide a negative number as an argument · fas..."
description: "!https://github.com/fastapi/typer/discussions/798"
date: 2024-10-30
published: true
tags:
  - cli
  - python
  - thought
  - typer
template: link
---


<div class="embed-card embed-card-external">
  <a href="https://github.com/fastapi/typer/discussions/798" class="embed-card-link" target="_blank" rel="noopener noreferrer">
    <div class="embed-card-image">
      <img src="https://opengraph.githubassets.com/2b48b76b8e15f361c37084d34fa4151bc54fda7ca95e0b320b739bd0f6075316/fastapi/typer/discussions/798" alt="Document how to provide a negative number as an argument · fastapi typer · Discussion #798 — First Check I added a very descriptive title here. I used the GitHub search to find a similar question and didn&#39;t find it. I searched the Typer documentation, with the integrated search. I already ..." loading="lazy">
    </div>
    <div class="embed-card-content">
      <div class="embed-card-title">Document how to provide a negative number as an argument · fastapi typer · Discussion #798</div>
      <div class="embed-card-description">First Check I added a very descriptive title here. I used the GitHub search to find a similar question and didn&#39;t find it. I searched the Typer documentation, with the integrated search. I already ...</div>
      <div class="embed-card-meta">GitHub &middot; github.com</div>
    </div>
  </a>
</div>


Today I learned that you cannot pass negative integers as values to typer.  in this case `context_settings={"ignore_unknown_options": True}` is required so that the `-` does not look like a flag.

``` python
# script name: main.py

import typer

app = typer.Typer()


@app.command()
def failing(value: float):
    print(f"{value=}")
    

@app.command(
    context_settings={"ignore_unknown_options": True}
)
def working_good(value: float):
    print(f"{value=}")
    
    
if __name__ == "__main__":
    app()
```
