Customizability and naming conventions for each completion #539
Replies: 6 comments 43 replies
-
[Completed: moved to #731 (comment)] Internal variables / mutable variables (caching)In our test suite, we test that the completion functions don't change the environment. But caching is mentioned in #455 (comment). I searched for the corresponding completion and found gradle/gradle-completion: Gradle tab completion for bash and zsh where README.md has the following description:
I think it might be also good to provide a rule for internal variables and mutable variables which can be used for caching the completion results. For example, |
Beta Was this translation helpful? Give feedback.
-
In general, I'm a believer in "if everything else fails, then make it customizable/configurable". We should strive to make things Just Work. And a lot of our stuff kind of is customizable by providing a whole implementation of an entire function. Granted, that's a tedious, big gun approach, and more surgical customizability would be better from that respect.
"Depends". But we should think hard before accepting or rejecting.
I'm all for consistency, and aligning with the new
Aside, we have some of that also in CONTRIBUTING.md. Should converge to one doc.
Nope, that's an oversight. Fixed, thanks. |
Beta Was this translation helpful? Give feedback.
-
[Completed: moved to #731] Current proposal
Update 2021-06-15: I have replaced "helper" with "utility". |
Beta Was this translation helpful? Give feedback.
-
[Completed] More flexible positions of double underscores in the names?Maybe we have already discussed this somewhere, but I don't remember well. While implementing functions, I felt I actually wanted a finer control of scoping in an arbitrary position of double underscores as I have originally described in #539 (reply in thread):
|
Beta Was this translation helpful? Give feedback.
-
[Completed] Naming of local variables in the function that exports variables of dynamic names?When we would like to define a function that receives a variable name in the argument and operates on the variable, naively, the local variable names defined in the function should not conflict with the variable name specified in the argument.
In the latter case, what would be the naming convetion of such local variables?
|
Beta Was this translation helpful? Give feedback.
-
Renaming existing functions: just prefixing
|
Beta Was this translation helpful? Give feedback.
-
In #527, I raised the following question.
After that I actually found the following reply in #455:
Does it mean we don't want to introduce customizability for completions? When we received a pull request with customization options (such as #491), should we reject the PR?
Variable names
I also noticed that there are actually already existing customization through the variables of the form
COMP_{CommandName}_{ConfigName}
indoc/bash_completion.txt
(Actually, there is only one variable,COMP_TAR_INTERNAL_PATHS
, for completion for a command). Is this the naming convention for the customization of the completion for each command? Maybe we should explicitly standardize the name asCOMP_CMD_{CommandName}_{ConfigName}
.Function names
I also found that the text file
doc/styleguide.txt
contains useful guidelines. According to this document, the new completion function is recommended to have the form_comp_cmd_{CommandName}
.In fact I can find the following instances:
However, e.g., in the latest pull request #532, the function names don't follow
styleguide.txt
. Is the description instyleguide.txt
experimental or outdated? Have you changed your mind to make the rule simpler? I actually agree that it is a good idea to prefix_comp_
/_comp_cmd_
forbash_completion
related functions.Beta Was this translation helpful? Give feedback.
All reactions