]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
scripts: vscode configuration
authorVasek Sraier <git@vakabus.cz>
Wed, 7 Apr 2021 20:53:26 +0000 (22:53 +0200)
committerAleš Mrázek <ales.mrazek@nic.cz>
Fri, 8 Apr 2022 14:17:52 +0000 (16:17 +0200)
manager/pyproject.toml
manager/scripts/configure-vscode [new file with mode: 0755]

index 4a97c198858f84f516f0da32286db67a71ae2965..e21fa64bb6e68cca19483bfa082b0c4a5c986bd8 100644 (file)
@@ -52,6 +52,7 @@ clean = """
 """
 tox = { cmd = "tox", help = "Run tests in tox" }
 integration = {cmd = "python integration/runner.py", help = "Run integration tests" }
+configure-vscode = {cmd = "scripts/configure-vscode", help = "Create VSCode configuration for debugging, virtual envs etc" }
 
 
 [tool.black]
diff --git a/manager/scripts/configure-vscode b/manager/scripts/configure-vscode
new file mode 100755 (executable)
index 0000000..7428848
--- /dev/null
@@ -0,0 +1,58 @@
+#!/bin/bash
+
+# fail early
+set -e
+
+# ensure consistent behaviour
+src_dir="$(dirname "$(realpath "$0")")"
+source $src_dir/_env.sh
+
+
+echo -e "${yellow}This script will overwrite your existing VSCode configuration in the .vscode directory${reset}"
+echo -e "${red}Should we proceed? [yN]${reset}"
+read confirmation
+if test "$confirmation" = "y" -o "$confirmation" = "Y"; then
+    echo -e "${green}OK, changing your VSCode configuration${reset}"
+else
+    echo -e "${red}Aborting${reset}"
+    exit 1
+fi
+
+
+mkdir -p .vscode
+
+# settings.json
+cat > .vscode/settings.json <<EOF
+{
+    "python.pythonPath": "$(poetry env info -p)",
+    "python.venvPath": "~/.cache/pypoetry/virtualenvs"
+}
+EOF
+
+
+# launch.json
+cat > .vscode/launch.json <<EOF
+{
+    // Use IntelliSense to learn about possible attributes.
+    // Hover to view descriptions of existing attributes.
+    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
+    "version": "0.2.0",
+    "configurations": [
+        {
+            "name": "Python: Remote Attach",
+            "type": "python",
+            "request": "attach",
+            "connect": {
+                "host": "localhost",
+                "port": 5678
+            },
+            "pathMappings": [
+                {
+                    "localRoot": "${workspaceFolder}",
+                    "remoteRoot": "."
+                }
+            ]
+        }
+    ]
+}
+EOF
\ No newline at end of file