diff options
| author | Teddy Wing | 2022-06-25 15:49:09 +0200 |
|---|---|---|
| committer | Teddy Wing | 2022-06-25 15:49:09 +0200 |
| commit | ccf0acd8a81c62e1c0bc26d3512e2508191d110a (patch) | |
| tree | 500d96e7ad7ceb5fb8b105c517bb9c69dd01def1 | |
| parent | 88b89ee64baeada05b906024d632c97a68920173 (diff) | |
| download | cws-status-ccf0acd8a81c62e1c0bc26d3512e2508191d110a.tar.bz2 | |
cws-status: Add command line argument parsing
Get the CWS dashboard URL and Chrome cookie path from command line
arguments.
| -rw-r--r-- | cws-status | 25 |
1 files changed, 19 insertions, 6 deletions
@@ -1,5 +1,7 @@ #!/usr/bin/env python3 +import argparse +import os import re import sys from urllib import request @@ -12,17 +14,28 @@ EX_USAGE = 64 EX_NOUSER = 67 -if len(sys.argv) < 2: - print('error: missing regex argument', file=sys.stderr) - sys.exit(EX_USAGE) +argparser = argparse.ArgumentParser(description='Query the publish status of \ + extensions on the Chromw Web Store dashboard.') +argparser.add_argument( + '--url', + required=True, + help='Chrome Web Store dashboard URL' +) +argparser.add_argument( + '--cookie-path', + required=True, + help='path to a Google Chrome cookie file' +) +argparser.add_argument('name_regex', metavar='<name-regex>') -regex = sys.argv[1] +args = argparser.parse_args() -url = 'https://chrome.google.com/webstore/devconsole/<UUID>' +url = args.url +regex = args.name_regex cookie_jar = browser_cookie3.chrome( - cookie_file='<profile-cookie-file>', + cookie_file=os.path.expanduser(args.cookie_path), ) opener = request.build_opener(request.HTTPCookieProcessor(cookie_jar)) |
