From a7b41ae536a17d0284a6b14cb0b4cb554895af2a Mon Sep 17 00:00:00 2001 From: Tom Levy Date: Fri, 30 Jun 2023 07:16:38 +0000 Subject: [PATCH 1/3] ftplib: Fix typo in doc of test program (-p: password => passive) The -p option toggles passive mode, it is not related to passwords. (Aside: Passwords can be passed using a .netrc file.) --- Lib/ftplib.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/ftplib.py b/Lib/ftplib.py index a56e0c3085701b..601215b701b28f 100644 --- a/Lib/ftplib.py +++ b/Lib/ftplib.py @@ -904,7 +904,7 @@ def test(): -d dir -l list - -p password + -p toggle passive mode ''' if len(sys.argv) < 2: From e0abd6311e64f69526faba85bd4cf7446ed9ada0 Mon Sep 17 00:00:00 2001 From: Tom Levy Date: Fri, 30 Jun 2023 07:20:22 +0000 Subject: [PATCH 2/3] ftplib: Clarify doc of -d[dir] option in test program Explain that it changes the working directory. Also reorder to match the order in the Usage, to clarify that this is referring to the -d[dir] option after the host, as opposed to the -d option before the host (which enables debugging). --- Lib/ftplib.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/ftplib.py b/Lib/ftplib.py index 601215b701b28f..10676dfb51f44d 100644 --- a/Lib/ftplib.py +++ b/Lib/ftplib.py @@ -902,8 +902,8 @@ def test(): '''Test program. Usage: ftp [-d] [-r[file]] host [-l[dir]] [-d[dir]] [-p] [file] ... - -d dir -l list + -d change directory -p toggle passive mode ''' From 53113270e7ccbac66c37dd37a53dfd70953bf32d Mon Sep 17 00:00:00 2001 From: Tom Levy Date: Fri, 30 Jun 2023 07:37:39 +0000 Subject: [PATCH 3/3] ftplib: Add -h/--help option to test program Previously it only printed the help message when invoked with no arguments (`python3 -m ftplib`). Add support for the standard -h/--help option, so that users who run `python3 -m ftplib --help` will get a nice help message instead of a backtrace (caused by "--help" being interpreted as the host). --- Lib/ftplib.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/ftplib.py b/Lib/ftplib.py index 10676dfb51f44d..c2e317dc6a7556 100644 --- a/Lib/ftplib.py +++ b/Lib/ftplib.py @@ -907,7 +907,7 @@ def test(): -p toggle passive mode ''' - if len(sys.argv) < 2: + if len(sys.argv) < 2 or sys.argv[1] in ('-h', '--help'): print(test.__doc__) sys.exit(0)