Comments (4)
Hi, thanks for your interest in argcomplete. Are you calling argcomplete.warn()
outside the context of a completer callable? It is only supported in completer callables (and only when they are invoked). Can you give a complete example (including the Python portion)?
from argcomplete.
@kislyuk Thanks for the reply! I don't mean anything special. Let's just take the following simple example and let's assume I want to see the value of COMP_LINE
when in autocomplete mode for debugging purposes. Let's call the file argcomplete-test.py
and do eval "$(register-python-argcomplete3 ./argcomplete-test.py)"
and then type ./argcomplete-test.py <TAB>
. Is there any sensible way (without meddling with the bash function) to see what the print statement prints outside of a completer callable?
#!/usr/bin/env python3
# PYTHON_ARGCOMPLETE_OK
import argparse
import argcomplete
import os
import sys
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--foo', required=True, help='foo help')
comp_line = os.getenv('COMP_LINE', '[not in AC mode]')
print('COMP_LINE: %s' % comp_line, file=sys.stderr)
argcomplete.autocomplete(parser)
args = parser.parse_args()
print(args.foo)
if __name__ == '__main__':
main()
from argcomplete.
No - the muting of print statements is intentional. Programs that depend on argcomplete print a variety of stuff during their startup process that we don't want to be shown when pressing <TAB>
.
from argcomplete.
In general, argcomplete.warn()
is only supported in completers. This is because argcomplete.warn()
is not instrumented to run in the caller scope until argcomplete.autocomplete()
is called - and once it's called, it never returns (as described in the docs). The only reason warn()
is supported in completers is that they are callbacks - they get called in the course of running autocomplete()
.
I'm going to close this issue now, since it doesn't seem to be describing a bug. If you feel like there's a bug or missing feature, please feel free to describe the specifics of how it would be implemented while maintaining the existing API/protocol.
from argcomplete.
Related Issues (20)
- Generate zsh completion functions HOT 2
- zsh does behave weird if choice contains colon HOT 2
- `argcomplete` adds entries to `.bash_completion`, even when action is abandoned HOT 1
- installing zsh globally adds paths to completion options introduced in v3.1.4 HOT 1
- Contributing guidelines for argcomplete? HOT 2
- How do I exclude files in the users directory from the tab completion? HOT 2
- Unable to get completion to work for NetExec HOT 2
- zsh: completion fails with script path starting with '~/' HOT 1
- 3.2.2: pytest is failing HOT 1
- Generating lazy completion scripts for Bash/Zsh HOT 1
- Problem with os.get_terminal_size() and argcomplete HOT 2
- completion with a leading dash HOT 2
- Problems with trust path when packaging HOT 6
- No automatic testing on windows? HOT 2
- Python 3.13: Some tests fail when run with latest Python pre-release HOT 5
- Check recent argparse API changes for compatibility HOT 2
- completer falls back to Bash filename completion
- Python 3.12.3: Test suite fails HOT 1
- autocompletion is slow and stuck HOT 2
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 argcomplete.