Merge pull request #135 from eggplants/fix_cli

Fix cli.py
This commit is contained in:
Akash Mahanty 2022-02-05 16:54:36 +05:30 committed by GitHub
commit b79f1c471e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -218,7 +218,6 @@ def save_urls_on_file(url_gen: Generator[str, None, None]) -> None:
+ "will be printed.", + "will be printed.",
) )
def main( # pylint: disable=no-value-for-parameter def main( # pylint: disable=no-value-for-parameter
url: Optional[str],
user_agent: str, user_agent: str,
version: bool, version: bool,
show_license: bool, show_license: bool,
@ -226,33 +225,34 @@ def main( # pylint: disable=no-value-for-parameter
oldest: bool, oldest: bool,
json: bool, json: bool,
near: bool, near: bool,
year: Optional[int],
month: Optional[int],
day: Optional[int],
hour: Optional[int],
minute: Optional[int],
save: bool, save: bool,
headers: bool, headers: bool,
known_urls: bool, known_urls: bool,
subdomain: bool, subdomain: bool,
file: bool, file: bool,
cdx: bool, cdx: bool,
start_timestamp: Optional[str],
end_timestamp: Optional[str],
cdx_filter: List[str], cdx_filter: List[str],
match_type: Optional[str],
gzip: Optional[str],
collapse: List[str], collapse: List[str],
limit: Optional[str],
cdx_print: List[str], cdx_print: List[str],
url: Optional[str] = None,
year: Optional[int] = None,
month: Optional[int] = None,
day: Optional[int] = None,
hour: Optional[int] = None,
minute: Optional[int] = None,
start_timestamp: Optional[str] = None,
end_timestamp: Optional[str] = None,
match_type: Optional[str] = None,
gzip: Optional[str] = None,
limit: Optional[str] = None,
) -> None: ) -> None:
"""\b """\b
_ _ _ _
| | | | | | | |
__ ____ _ _ _| |__ __ _ ___| | ___ __ _ _ __ ____ _ _ _| |__ __ _ ___| | ___ __ _ _
\ \ /\ / / _` | | | | '_ \ / _` |/ __| |/ / '_ \| | | | \\ \\ /\\ / / _` | | | | '_ \\ / _` |/ __| |/ / '_ \\| | | |
\ V V / (_| | |_| | |_) | (_| | (__| <| |_) | |_| | \\ V V / (_| | |_| | |_) | (_| | (__| <| |_) | |_| |
\_/\_/ \__,_|\__, |_.__/ \__,_|\___|_|\_\ .__/ \__, | \\_/\\_/ \\__,_|\\__, |_.__/ \\__,_|\\___|_|\\_\\ .__/ \\__, |
__/ | | | __/ | __/ | | | __/ |
|___/ |_| |___/ |___/ |_| |___/
@ -276,7 +276,7 @@ def main( # pylint: disable=no-value-for-parameter
).text ).text
) )
elif url is None: elif url is None:
click.echo("No URL detected. Please provide an URL.") click.echo("No URL detected. Please provide an URL.", err=True)
elif ( elif (
not version not version
and not oldest and not oldest
@ -288,7 +288,8 @@ def main( # pylint: disable=no-value-for-parameter
): ):
click.echo( click.echo(
"Only URL passed, but did not specify what to do with the URL. " "Only URL passed, but did not specify what to do with the URL. "
"Use --help flag for help using waybackpy." "Use --help flag for help using waybackpy.",
err=True,
) )
elif oldest: elif oldest:
availability_api = WaybackMachineAvailabilityAPI(url, user_agent=user_agent) availability_api = WaybackMachineAvailabilityAPI(url, user_agent=user_agent)
@ -383,4 +384,4 @@ def main( # pylint: disable=no-value-for-parameter
if __name__ == "__main__": if __name__ == "__main__":
main() main() # pylint: disable=no-value-for-parameter