---
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:
  - python
  - cli
  - typer
  - thought
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()
```

!!! note

    This post is a <a href="/thoughts/" class="wikilink" data-title="Thoughts" data-description="These are generally my thoughts on a web page or some sort of url, except a rare few don&#39;t have a link. These are dual published off of my..." data-date="2024-04-01">thought</a>. It's a short note that I make
    about someone else's content online <a href="/tags/thoughts/" class="hashtag-tag" data-tag="thoughts" data-count=2 data-reading-time=3 data-reading-time-text="3 minutes">#thoughts</a>
