MCPcopy
hub / github.com/ArchiveBox/ArchiveBox / main

Function main

archivebox/cli/archivebox_remove.py:18–78  ·  view source on GitHub ↗
(args: Optional[List[str]]=None, stdin: Optional[IO]=None, pwd: Optional[str]=None)

Source from the content-addressed store, hash-verified

16
17@docstring(remove.__doc__)
18def main(args: Optional[List[str]]=None, stdin: Optional[IO]=None, pwd: Optional[str]=None) -> None:
19 parser = argparse.ArgumentParser(
20 prog=__command__,
21 description=remove.__doc__,
22 add_help=True,
23 formatter_class=SmartFormatter,
24 )
25 parser.add_argument(
26 '--yes', # '-y',
27 action='store_true',
28 help='Remove links instantly without prompting to confirm.',
29 )
30 parser.add_argument(
31 '--delete', # '-r',
32 action='store_true',
33 help=(
34 "In addition to removing the link from the index, "
35 "also delete its archived content and metadata folder."
36 ),
37 )
38 parser.add_argument(
39 '--before', #'-b',
40 type=float,
41 help="List only URLs bookmarked before the given timestamp.",
42 default=None,
43 )
44 parser.add_argument(
45 '--after', #'-a',
46 type=float,
47 help="List only URLs bookmarked after the given timestamp.",
48 default=None,
49 )
50 parser.add_argument(
51 '--filter-type',
52 type=str,
53 choices=('exact', 'substring', 'domain', 'regex','tag'),
54 default='exact',
55 help='Type of pattern matching to use when filtering URLs',
56 )
57 parser.add_argument(
58 'filter_patterns',
59 nargs='*',
60 type=str,
61 help='URLs matching this filter pattern will be removed from the index.'
62 )
63 command = parser.parse_args(args or ())
64
65 filter_str = None
66 if not command.filter_patterns:
67 filter_str = accept_stdin(stdin)
68
69 remove(
70 filter_str=filter_str,
71 filter_patterns=command.filter_patterns,
72 filter_type=command.filter_type,
73 before=command.before,
74 after=command.after,
75 yes=command.yes,

Callers 1

Calls 2

accept_stdinFunction · 0.85
removeFunction · 0.85

Tested by

no test coverage detected