Counter

A counter is a special kind of flag, but instead of representing a boolean value, it represents (you guessed it) a count! A count parameter tallies the number of times that is used on the command line.

examples/parameter_count.py
import arc


@arc.command
def hello(firstname: str, repeat: int = arc.Count()):
    arc.print(f"Repeat {repeat} time(s)")
    for _ in range(0, repeat):
        arc.print(f"Hello, {firstname}! Hope you have a wonderful day!")


hello()
$ python parameter_count.py Joseph
Repeat 0 time(s)
$ python parameter_count.py Joseph --repeat
Repeat 1 time(s)
Hello, Joseph! Hope you have a wonderful day!
$ python parameter_count.py Joseph --repeat --repeat
Repeat 2 time(s)
Hello, Joseph! Hope you have a wonderful day!
Hello, Joseph! Hope you have a wonderful day!