-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmcp-path.sh
More file actions
executable file
·86 lines (73 loc) · 2.02 KB
/
mcp-path.sh
File metadata and controls
executable file
·86 lines (73 loc) · 2.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/bin/bash
# Get paths
NODE_PATH=$(which node)
FZF_PATH=$(which fzf)
# Check if both executables exist
if [ -z "$NODE_PATH" ] || [ -z "$FZF_PATH" ]; then
echo "Error: Could not find node or fzf"
exit 1
fi
# Copy paths to clipboard based on OS
if [[ "$OSTYPE" == "darwin"* ]]; then
# macOS
echo -e "$NODE_PATH\n$FZF_PATH" | pbcopy
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
# Linux with xclip
echo -e "$NODE_PATH\n$FZF_PATH" | xclip -selection clipboard
else
echo "Error: Unsupported operating system"
exit 1
fi
echo "Paths copied to clipboard:"
echo "node: $NODE_PATH"
echo "fzf: $FZF_PATH"
# Copy both paths to clipboard based on OS
if [[ "$OSTYPE" == "darwin"* ]]; then
# macOS
echo "$NODE_PATH $FZF_PATH" | pbcopy
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
# Linux with xclip
echo "$NODE_PATH $FZF_PATH" | xclip -selection clipboard
else
echo "Error: Unsupported operating system"
exit 1
fi
# Get node path
NODE_PATH=$(which node)
# Check if node exists
if [ -z "$NODE_PATH" ]; then
echo "Error: Could not find node"
exit 1
fi
# Copy path to clipboard based on OS
if [[ "$OSTYPE" == "darwin"* ]]; then
# macOS
echo "$NODE_PATH" | pbcopy
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
# Linux with xclip
echo "$NODE_PATH" | xclip -selection clipboard
else
echo "Error: Unsupported operating system"
exit 1
fi
echo "Node path copied to clipboard:"
echo "node: $NODE_PATH"
# Get list of files and select with fzf (excluding node_modules and hidden files)
FZF_PATH=$(find $(pwd) -type f -not -path '*/node_modules/*' -not -path '*/\.*' | "$(which fzf)" --height 40%)
# Check if fzf selection was made
if [ -z "$FZF_PATH" ]; then
echo "No file selected"
exit 1
fi
# Copy both paths to clipboard based on OS
if [[ "$OSTYPE" == "darwin"* ]]; then
# macOS
echo "$NODE_PATH $FZF_PATH" | pbcopy
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
# Linux with xclip
echo "$NODE_PATH $FZF_PATH" | xclip -selection clipboard
else
echo "Error: Unsupported operating system"
exit 1
fi
echo "Paths copied to clipboard"