Skip to content

Instantly share code, notes, and snippets.

@ahadsheriff
Created March 11, 2019 05:20
Show Gist options
  • Save ahadsheriff/ce3bb92353a595d8212b0c884137eb13 to your computer and use it in GitHub Desktop.
Save ahadsheriff/ce3bb92353a595d8212b0c884137eb13 to your computer and use it in GitHub Desktop.
For CLI tutorial
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