News for hackers. Stuff that matters.
Re:Kate and Python Language Server by dundarious on Tuesday May 06, 2025 @12:13AM (#43901753)
Please quote your variable expansions in bash. Otherwise, spaces, etc., will lead to issues.

It would also make sense to use path after it is defined, instead of sometimes using `$1` again.

And I'm confused by `cd`ing into `$path` but then checking paths that are prefixed by `$path`... I assume that is an error, and you won't run it like `script.sh ./work/project` and expect a path like `./work/project/work/project` or `./work/project/project` to exist.

  #!/usr/bin/env bash
  path="$1"
  if [ -d "$path/.venv" ]; then
    source "$path/.venv/bin/activate"
  fi
  if [ -d "$path/venv" ]; then
    source "$path/venv/bin/activate"
  fi
  cd "$path"
  exec pylsp --check-parent-process

There are no comments on this comment yet.