#580 Better UX with mistyped arguments
Opened 3 months ago by dreua. Modified 2 months ago

When ever a user has a typo or error in their arguments, the fedpkg displays a compacted list of all options which is not helpful at all tbh. Even though I know roughly what I need, this happens a lot to me. (And must be even more frustrating to new users.)

For example to do a mockbuild of the rawhide branch for my current release I do the following:

fedpkg --target f41 mock-build  # scratch-build would be correct, I'm not making this up ;)
fedpkg --release f41 mock-build  # nope
fedpkg --target f41 mockbuild   # still no
fedpkg --release f41 mockbuild  # finally got it

There are multiple ways to improve UX here:
- Repeat the argument which was not found / wrong (users can narrow down their search space)
- Ideally print a "did you mean <similar arguments>"
- Don't compact the list of commands, this is just hard to parse for humans
- Ideally normalize the names to a scheme, i.e. not mockbuild but scratch-build; having aliases either way would be a good solution now imo.

This is a recurring pain point for me in an otherwise very helpful tool, thanks everyone for making it :heart:

Let me know what you think, I may even consider to code it myself just to help future-me.


In case you have never mistyped something, here is the current typo message:

$ fedpkg --target f41 mockbuild
usage: fedpkg [-h] [--config CONFIG] [--dry-run] [--release RELEASE] [--name NAME] [--namespace NAMESPACE] [--user USER] [--password PASSWORD] [--runas RUNAS] [--path PATH] [--verbose] [--debug] [-q] [--user-config USER_CONFIG]
{help,build,chain-build,clean,clog,clone,co,copr-build,commit,ci,compile,container-build,container-build-setup,diff,flatpak-build,gimmespec,gitbuildhash,gitcred,giturl,import,install,lint,list-side-tags,local,mockbuild,mock-config,module-build,module-scratch-build,module-build-cancel,module-build-info,module-build-local,module-build-watch,module-overview,new,new-sources,patch,pre-push-check,prep,pull,push,remote,remove-side-tag,request-side-tag,retire,scratch-build,sources,srpm,switch-branch,tag,unused-patches,upload,verify-files,verrel,releases-info,update,request-repo,request-tests-repo,request-branch,fork,override,set-distgit-token,set-pagure-token,disable-monitoring} ...
fedpkg: error: argument {help,build,chain-build,clean,clog,clone,co,copr-build,commit,ci,compile,container-build,container-build-setup,diff,flatpak-build,gimmespec,gitbuildhash,gitcred,giturl,import,install,lint,list-side-tags,local,mockbuild,mock-config,module-build,module-scratch-build,module-build-cancel,module-build-info,module-build-local,module-build-watch,module-overview,new,new-sources,patch,pre-push-check,prep,pull,push,remote,remove-side-tag,request-side-tag,retire,scratch-build,sources,srpm,switch-branch,tag,unused-patches,upload,verify-files,verrel,releases-info,update,request-repo,request-tests-repo,request-branch,fork,override,set-distgit-token,set-pagure-token,disable-monitoring}: invalid choice: 'f41' (choose from 'help', 'build', 'chain-build', 'clean', 'clog', 'clone', 'co', 'copr-build', 'commit', 'ci', 'compile', 'container-build', 'container-build-setup', 'diff', 'flatpak-build', 'gimmespec', 'gitbuildhash', 'gitcred', 'giturl', 'import', 'install', 'lint', 'list-side-tags', 'local', 'mockbuild', 'mock-config', 'module-build', 'module-scratch-build', 'module-build-cancel', 'module-build-info', 'module-build-local', 'module-build-watch', 'module-overview', 'new', 'new-sources', 'patch', 'pre-push-check', 'prep', 'pull', 'push', 'remote', 'remove-side-tag', 'request-side-tag', 'retire', 'scratch-build', 'sources', 'srpm', 'switch-branch', 'tag', 'unused-patches', 'upload', 'verify-files', 'verrel', 'releases-info', 'update', 'request-repo', 'request-tests-repo', 'request-branch', 'fork', 'override', 'set-distgit-token', 'set-pagure-token', 'disable-monitoring')

(Deliberatly not in code tags because with automatic linebreaks it is closer to your expereince in the terminal.)

Hi @dreua
I agree, that some commands especially combinations with arguments might be confusing, especially for new users.
Some issues you mentioned could be avoided by using already-implemented argcomplete functionality (it replaced bash-completion but works similarly). Have you considered it?
I admit, that many users don't have this enabled - So far I haven't found a way how to integrate it in the system of fedpkg's users and even whether it is a good idea.

$ eval "$(register-python-argcomplete fedpkg)"

No I haven't tried that. Unless this is automatically installed and enabled when installing fedpkg (or actively promoted) I don't see how that is going to help the majority of users tbh.

Log in to comment on this ticket.

Metadata