Created
May 27, 2023 00:04
-
-
Save sleexyz/852d38158190187050515c6ad0ba9c2e to your computer and use it in GitHub Desktop.
wrapper around just that always nix develops
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
self: super: { | |
just-wrapper = super.writeShellScriptBin "just" '' | |
# Check if path argument is provided | |
if [ -z "$1" ]; then | |
echo "Usage: just <path> [extra_arguments]" | |
exit 1 | |
fi | |
# Split the path into $DIRECTORY and $COMMAND | |
DIRECTORY=$(dirname "$1") | |
COMMAND=$(basename "$1") | |
EXTRA_ARGUMENTS="${ "\${@:2}" }" | |
# Run the command in the desired directory | |
(cd "$DIRECTORY"; exec nix develop --command sh -c "${super.just}/bin/just $COMMAND $EXTRA_ARGUMENTS") | |
''; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment