(args: Optional[List[str]]=None, stdin: Optional[IO]=None, pwd: Optional[str]=None)
| 17 | |
| 18 | @docstring(add.__doc__) |
| 19 | def main(args: Optional[List[str]]=None, stdin: Optional[IO]=None, pwd: Optional[str]=None) -> None: |
| 20 | parser = argparse.ArgumentParser( |
| 21 | prog=__command__, |
| 22 | description=add.__doc__, |
| 23 | add_help=True, |
| 24 | formatter_class=SmartFormatter, |
| 25 | ) |
| 26 | parser.add_argument( |
| 27 | '--tag', '-t', |
| 28 | type=str, |
| 29 | default='', |
| 30 | help="Tag the added URLs with the provided tags e.g. --tag=tag1,tag2,tag3", |
| 31 | ) |
| 32 | parser.add_argument( |
| 33 | '--update', #'-u', |
| 34 | action='store_true', |
| 35 | default=not ONLY_NEW, # when ONLY_NEW=True we skip updating old links |
| 36 | help="Also retry previously skipped/failed links when adding new links", |
| 37 | ) |
| 38 | parser.add_argument( |
| 39 | '--update-all', #'-n', |
| 40 | action='store_true', |
| 41 | default=False, |
| 42 | help="Also update ALL links in index when finished adding new links", |
| 43 | ) |
| 44 | parser.add_argument( |
| 45 | '--index-only', #'-o', |
| 46 | action='store_true', |
| 47 | help="Add the links to the main index without archiving them", |
| 48 | ) |
| 49 | parser.add_argument( |
| 50 | 'urls', |
| 51 | nargs='*', |
| 52 | type=str, |
| 53 | default=None, |
| 54 | help=( |
| 55 | 'URLs or paths to archive e.g.:\n' |
| 56 | ' https://getpocket.com/users/USERNAME/feed/all\n' |
| 57 | ' https://example.com/some/rss/feed.xml\n' |
| 58 | ' https://example.com\n' |
| 59 | ' ~/Downloads/firefox_bookmarks_export.html\n' |
| 60 | ' ~/Desktop/sites_list.csv\n' |
| 61 | ) |
| 62 | ) |
| 63 | parser.add_argument( |
| 64 | "--depth", |
| 65 | action="store", |
| 66 | default=0, |
| 67 | choices=[0, 1], |
| 68 | type=int, |
| 69 | help="Recursively archive all linked pages up to this many hops away" |
| 70 | ) |
| 71 | parser.add_argument( |
| 72 | "--overwrite", |
| 73 | default=False, |
| 74 | action="store_true", |
| 75 | help="Re-archive URLs from scratch, overwriting any existing files" |
| 76 | ) |
no test coverage detected