nixpkgs-tools/treewideMainProgram/ed_main_program.sh

16 lines
308 B
Bash
Executable File

#!/usr/bin/env bash
PACKAGE_PATH=$1
PACKAGE_NAME=$1
if [ -f $1 ]; then
PACKAGE_NAME=$(dirname $PACKAGE_NAME)
else
PACKAGE_PATH="${PACKAGE_PATH%%/}/default.nix"
fi
PACKAGE_NAME="${PACKAGE_NAME%/}"
PACKAGE_NAME="${PACKAGE_NAME##*/}"
NVIM_CLIPBOARD="mainProgram = \"$PACKAGE_NAME\";" nvim $PACKAGE_PATH