-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathp.fish
More file actions
17 lines (17 loc) · 712 Bytes
/
p.fish
File metadata and controls
17 lines (17 loc) · 712 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
function p --description "Determine package manager and run command with it"
if [ -f ./pnpm-lock.yaml ];
if ! command -vq pnpm; echo "Pnpm usage detected but not installed"; return; end
pnpm $argv
else if [ -f ./package-lock.json ];
if ! command -vq npm; echo "NPM usage detected but not installed"; return; end
npm "$argv"
else if [ -f ./yarn.lock ];
if ! command -vq yarn; echo "Yarn usage detected but not installed"; return; end
yarn $argv
else if [ -f ./bun.lockb ];
if ! command -vq bun; echo "Bun usage detected but not installed"; return; end
bun $argv
else
echo "No package manager usage detected."
end
end