summarylogtreecommitdiffstats
path: root/poetry-completions-generator
diff options
context:
space:
mode:
Diffstat (limited to 'poetry-completions-generator')
-rwxr-xr-xpoetry-completions-generator15
1 files changed, 15 insertions, 0 deletions
diff --git a/poetry-completions-generator b/poetry-completions-generator
new file mode 100755
index 000000000000..e0a1d3929aeb
--- /dev/null
+++ b/poetry-completions-generator
@@ -0,0 +1,15 @@
+#!/usr/bin/python3
+
+# This is a dummy script that fakes its own sys.argv[0] to make the completions
+# subcommand do the correct thing when run from the build directory. cleo's
+# completion generator uses this to generate completions for sys.argv[0] as well
+# as (???) os.path.join(os.getcwd(), sys.argv[0]) for mysterious reasons.
+#
+# We don't want to complete 'poetry/__main__.py'....
+
+import sys
+from poetry.console import main
+
+sys.argv = ['poetry', 'completions', sys.argv.pop()]
+
+main()