-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy path__main__.py
More file actions
24 lines (17 loc) · 700 Bytes
/
Copy path__main__.py
File metadata and controls
24 lines (17 loc) · 700 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
"""Example main module for the CLI application."""
import argparse
import sys
from . import fibonacci_sequence
def main() -> None:
"""Generate and print a Fibonacci sequence based on command line arguments."""
parser = argparse.ArgumentParser(
prog="bonacci",
description="Generate a Fibonacci sequence up to the given number of terms",
)
parser.add_argument("-v", "--version", action="version", version="0.0.0")
parser.add_argument("n", type=int, help="The number of terms")
args = parser.parse_args()
sequence = fibonacci_sequence(args.n)
sys.stdout.write(f"{' '.join(str(item) for item in sequence)}\n")
if __name__ == "__main__":
main()