Skip to content

Conversation

tom93
Copy link
Contributor

@tom93 tom93 commented Jun 30, 2023

Trivial fixes and improvements for help feature of the test program included with the ftplib module.

tom93 added 3 commits June 30, 2023 07:16
The -p option toggles passive mode, it is not related to passwords.

(Aside: Passwords can be passed using a .netrc file.)
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).
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).
@serhiy-storchaka
Copy link
Member

It would be better to rewrite argument parsing using getopt or argparse.

@tom93
Copy link
Contributor Author

tom93 commented Jan 18, 2024

Hi @serhiy-storchaka, thanks for taking a look.

I'd be happy to have a go switching to getopt/argparse, but it seems slightly tricky -- I think the options after the host arg would still have to be parsed by hand.

I opened this PR because there was an actual mistake in the help for -p (see first commit), I think it's worth fixing that independently of switching to getopt/argparse. (The other two commits are also trivial, so I think might as well merge them too.)

@serhiy-storchaka
Copy link
Member

Ah, I see. The help was incorrect.

But it is more complicated, because the CLI has more options (it is especially confusing that it has two -d options). Also, it has a bug in retrieving files. I created #114241 for this.

@tom93
Copy link
Contributor Author

tom93 commented Jan 18, 2024

Also, it has a bug in retrieving files.

Oh wow, I'm surprised I didn't notice that. Closing in favour of your PR (#114242).

Thanks for doing the maintenance work, I think it's a useful little tool!

@tom93 tom93 closed this Jan 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants