Code Dogs Technical Documentation
Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

CLI Cheat Sheet

Imports

import argparse

Usage

parser = argparse.ArgumentParser()

parser.add_argument("-n", "--name", help="Your name", required=True)
parser.add_argument('-a', '--age', help="Your age", default=21, type=int)
parser.add_argument('-H', '--happy', help="You are happy", action=argparse.BooleanOptionalAction)

args = parser.parse_args()

print(f'hello {args.name}')