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.",
)
def main( # pylint: disable=no-value-for-parameter
url: Optional[str],
user_agent: str,
version: bool,
show_license: bool,
@ -226,33 +225,34 @@ def main( # pylint: disable=no-value-for-parameter
oldest: bool,
json: bool,
near: bool,
year: Optional[int],
month: Optional[int],
day: Optional[int],
hour: Optional[int],
minute: Optional[int],
save: bool,
headers: bool,
known_urls: bool,
subdomain: bool,
file: bool,
cdx: bool,
start_timestamp: Optional[str],
end_timestamp: Optional[str],
cdx_filter: List[str],
match_type: Optional[str],
gzip: Optional[str],
collapse: List[str],
limit: Optional[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:
"""\b
_ _
| | | |
__ ____ _ _ _| |__ __ _ ___| | ___ __ _ _
\ \ /\ / / _` | | | | '_ \ / _` |/ __| |/ / '_ \| | | |
\ V V / (_| | |_| | |_) | (_| | (__| <| |_) | |_| |
\_/\_/ \__,_|\__, |_.__/ \__,_|\___|_|\_\ .__/ \__, |
\\ \\ /\\ / / _` | | | | '_ \\ / _` |/ __| |/ / '_ \\| | | |
\\ V V / (_| | |_| | |_) | (_| | (__| <| |_) | |_| |
\\_/\\_/ \\__,_|\\__, |_.__/ \\__,_|\\___|_|\\_\\ .__/ \\__, |
__/ | | | __/ |
|___/ |_| |___/
@ -276,7 +276,7 @@ def main( # pylint: disable=no-value-for-parameter
).text
)
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 (
not version
and not oldest
@ -288,7 +288,8 @@ def main( # pylint: disable=no-value-for-parameter
):
click.echo(
"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:
availability_api = WaybackMachineAvailabilityAPI(url, user_agent=user_agent)
@ -383,4 +384,4 @@ def main( # pylint: disable=no-value-for-parameter
if __name__ == "__main__":
main()
main() # pylint: disable=no-value-for-parameter