Comments (9)
Please refer to our wiki: https://github.com/TeX-Live/texdoc/wiki/Tab-completion
from texdoc.
Oh, I thought the code stores the option names and option help text in a data structure, then use the data structure to parse command line input and generate
help text from a template like https://github.com/latex3/l3build/blob/main/l3build-help.lua#L41-L93. If so, we can generate completion script from
a template and add a new option to print the script like
--help
to print help text. However, there doesn't exist this data structure.
This code just use a written manually help text
https://github.com/TeX-Live/texdoc/blob/master/script/texdoclib-const.tlu#L38-L58
And parse command line input by many if-clauses in
https://github.com/TeX-Live/texdoc/blob/master/script/texdoclib-cli.tlu#L101-L146
So I think if it is hard to generate shell scripts except there are some one would
rather to write one manually like
https://gist.github.com/wtsnjp/07d2b4acb04d5286d12d10d6021c2716. And this
written manually script must be updated when the new option be added, which is
usually out-of-time, compared to the script generated from a template.
from texdoc.
https://github.com/latex3/l3build/blob/main/l3build-arguments.lua#L37-L163 is the data structure I mentioned.
https://github.com/latex3/l3build/blob/main/l3build-help.lua#L41-L93 is using the data structure to generate help text.
https://github.com/latex3/l3build/pull/267/files#diff-6539b5c3e409d80383dc21dd22e22250445f066d4faf9f6deb8514e3c5bbc714R37-R133 is using the data structure to generate shell completion.
from texdoc.
Thanks for providing the details of your request and also pointers to the existing project, l3build.
Having a data structure of the command-line options is feasible. It is also possible to support a new option to generate the shell completion script. However, supporting multiple shells such as bash, csh, zsh, fish, and so on can be costly. Choosing one or two shells with a good reason might be difficult. Since most of the tools in TeX Live do not have such a feature, I wonder if only a few TeX Live users will use the feature. I don't want to have that burden directly in this project unless many people request it. Besides, this can be just done outside of this project.
(Hereafter, off-topic for this project)
The zsh completion function that I personally maintain is currently hosted at https://github.com/wtsnjp/texlive-completions.
As a maintainer of Texdoc, I am maintaining the script according to Texdoc updates for the time being, so please do not worry too much about that script will be outdated.
from texdoc.
Having a data structure of the command-line options is feasible.
👍
Choosing one or two shells with a good reason might be difficult.
I think it should be: if a shell user wants to support a shell, he will contribute code to this project. Not the maintainers support all shells by themselves. Because:
- The maintainers of the project are not possible to be familiar to all shells.
- If not any shell user contribute code, it proves the shell don't have enough value to be supported. That is a reason why some shells are supported and why some shells are not supported. (The reason is not difficult at all, really? 😄)
The zsh completion function that I personally maintain is currently hosted
I suggest pushing it to zsh-completions.
from texdoc.
Anyway, I don't have the time and motivation to implement and maintain this feature. I will only review codes if you send pull requests to us. In this case, please make sure to include the corresponding description in the documentation (texdoc.tex and texdoc.1.md) and test cases under the spec directory.
from texdoc.
Is there any project about a data structure of the command-line?
from texdoc.
No, there isn't. You can include that part also to the pull request if you have a plan.
from texdoc.
I'm glad to see this completion have been accepted by many Linux distributions.
from texdoc.
Related Issues (20)
- Extension of fuzzy search targets
- Reduce cache file size
- No "Locale unmatch" penalty when "lang" is missing HOT 1
- It seems the texdoc.cnf installed in texmf-dist/texdoc by default uses lastfile_switch=true thus preventing file in TEXMFHOME to have any effect HOT 7
- geeomtry-de preferred? HOT 5
- pkgname.pdf vs. pkgname-{foo,doc}.pdf HOT 2
- CTAN search link is deprecated HOT 2
- texdoc 4.0.1 prefers geometry-de HOT 2
- texdoc metafun finds mycow.pdf HOT 1
- erroneous option syntax -= gives lua error
- display them all -> allow number HOT 2
- structuredlog -> ltfilehook-doc
- Texdoc 4.0 Release HOT 1
- 4.0: Is opening doc with negative score disabled? HOT 3
- texdoc plain HOT 8
- Prompt for no "good" results HOT 2
- Prompt when there are too many results HOT 2
- New config item to control behavior when there are only negative matches HOT 5
- Fuzzy search should always be attempted HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from texdoc.