Python Double Tabbing In Cli To Show Compatible Files Only
Please find the following snippet: import argparse parser = argparse.ArgumentParser( description='Create plot from data', formatter_class=lambda prog: argparse.He
Solution 1:
When you press Tab, your shell expects to receive a list of strings (the possible completions).
- Either you register a Bash function to do the completion for your Python script (see this answer) so that your Python script is not called until the command line is finished.
- Or else you do it with your Python script (see this answer for
argcomplete
which mixes well withargparse
). In this case, Your Python script is indeed executed, but after computing the possible completions it will exit, and thus not run anything else. In other words, it will be called repeatedly to provide completion suggestions, then once at the end with the full command line to do its actual work.
Showing only the files with certain extensions depending on the argument is "just" a matter of customizing the completer. Your question is really just a duplicate of the other, but you seem to not see it. If the misunderstanding is actually on my side, please provide detailed explanations.
Post a Comment for "Python Double Tabbing In Cli To Show Compatible Files Only"