Created
March 11, 2019 05:20
-
-
Save ahadsheriff/ce3bb92353a595d8212b0c884137eb13 to your computer and use it in GitHub Desktop.
For CLI tutorial
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
welcome = "Practicing creating interactive command-line interfaces" | |
parser = argparse.ArgumentParser(description=welcome) | |
parser.add_argument('--domain', '-d', required=True, | |
help='domain name of the website you want to scrape. i.e. "https://ahadsheriff.com"') | |
parser.add_argument('--ofile', '-o', | |
help='define output file to save results of stdout. i.e. "output.txt"') | |
parser.add_argument('--lines', '-l', | |
help='number of lines of output to print to the console"', type=int) | |
parser.parse_args() | |
args = parser.parse_args() | |
domain = args.domain | |
ofile = args.ofile | |
lines = args.lines | |
print("domain:", domain) | |
print("output file:", ofile) | |
print("lines:", lines) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment