Ways to improve the command-line interface #1070
Replies: 3 comments 5 replies
-
Hi @pkgw, do you have any thoughts on this before I begin working on a PR? |
Beta Was this translation helpful? Give feedback.
-
I think clap's latest releases have a fairly aggressive MSRV, in that clap 4.4.0 bumped MSRV to 1.70 less than 2 months after the release of 1.70. So that is something to be aware of. I think it'd be good to perhaps consider a semi-recent clap with lower MSRV instead of the latest.
It does look like clap depends upon the termcolor crate, and that crate does support setting the |
Beta Was this translation helpful? Give feedback.
-
i will be against that.
|
Beta Was this translation helpful? Give feedback.
-
We interact with Tectonic via its command-line interface, or CLI. Its help messages concisely describe how to use Tectonic to build documents, etc. I think some minor yet effective improvements can be made to the help messages in order to improve the user experience.
For reference, here is the current V2 help message (
tectonic -X --help
):Suggestions
Combine flags and options
If you look at the above help output, or any help output from Tectonic, you will see one section for "flags" and one for "options". I propose merging these two into just "options". There is a comprehensive discussion of this in the
clap
repository (see below for introduction toclap
), and I agree with the main argument that separating flags from options complicates things unnecessarily;Sorting
Right now, "flags" in the help message are sorted alphabetically by their long name (i.e.,
--help
, not-h
). I think most of us approve of this, because it facilitates finding a specific option and makes the help message look nice. (Although, justifiable alternatives include sorting by commonly used options or options with similar functionality.)However, "options" currently sort by the name of their parameter (e.g.,
<level>
in--chatter <level>
). This deviates from the sorting of flags and has no correlation with the name of the option. I suggest we sort "options" the same way as "flags", especially if the two are merged.Color help messages if possible
Who doesn't love colors? AFAIK,
clap
does this by default.Migrate to
clap
Tectonic's internals currently use the
structopt
library to display and implement the CLI, but this library is old. As of February 2022,structopt
is in maintenance mode; there will be no new features added to it (and none have been added since the announcement last year). We like new features, because they may make development simpler.Additionally, one of the dependencies of
structopt
is not even being maintained anymore:ansi_term
. This gives warnings such as in #1034 and is very bad, because there will be no security or bug fixes.On the other hand,
clap
is popular and actively developed. As of v3, it does everythingstructopt
does at least as well. The latest major version is v4, which was released September 2022 and has a new release as recent as yesterday.clap
offers instructions for migrating fromstructopt
to v3 and from v3 to v4 that only require a little development effort.Beta Was this translation helpful? Give feedback.
All reactions