1
- echo "..."
2
- exit 1
1
+ echo "Installing CodePilot"
2
+
3
+ # check if git is installed
4
+ if [[ -z $(which git) ]]; then
5
+ echo "Git is not installed"
6
+ distro=$(lsb_release -i | cut -f 2-)
7
+ echo "Please install Git on $distro"
8
+ exit 1
9
+ fi
10
+
11
+ # check if gh is installed
12
+ if [[ -z $(which gh) ]]; then
13
+ echo "GitHub CLI is not installed"
14
+ distro=$(lsb_release -i | cut -f 2-)
15
+ echo "Please install GitHub CLI on $distro"
16
+ exit 1
17
+ fi
18
+
19
+ curl -s https://raw.githubusercontent.com/wasertech/CodePilot/main/scripts/codepilot > codepilot
20
+ chmod +x codepilot
21
+ # copy the codepilot script to /usr/local/bin
22
+ echo "Copying codepilot script to /usr/local/bin"
23
+ sudo cp codepilot /usr/local/bin/codepilot
24
+ # source the codepilot script in ~/.bashrc
25
+ # only if it is not already sourced
26
+
27
+ echo "Handling bash"
28
+ if [[ -f ~/.bashrc ]]; then
29
+ if [[ $(grep -c "source /usr/local/bin/codepilot" ~/.bashrc) -eq 0 ]]; then
30
+ echo "Sourcing codepilot script in ~/.bashrc"
31
+ echo "source /usr/local/bin/codepilot" >> ~/.bashrc
32
+ else
33
+ echo "CodePilot is already installed"
34
+ exit 0
35
+ fi
36
+ else
37
+ echo "Sourcing codepilot script in ~/.bashrc"
38
+ echo "source /usr/local/bin/codepilot" >> ~/.bashrc
39
+ fi
40
+
41
+ echo "Handling zsh"
42
+ if [[ -f ~/.zshrc ]]; then
43
+ if [[ $(grep -c "source /usr/local/bin/codepilot" ~/.zshrc) -eq 0 ]]; then
44
+ echo "Sourcing codepilot script in ~/.zshrc"
45
+ echo "source /usr/local/bin/codepilot" >> ~/.zshrc
46
+ else
47
+ echo "CodePilot is already installed"
48
+ exit 0
49
+ fi
50
+ else
51
+ echo "Sourcing codepilot script in ~/.zshrc"
52
+ echo "source /usr/local/bin/codepilot" >> ~/.zshrc
53
+ fi
54
+
55
+ echo "GitHub Copilot installed successfully"
56
+
57
+ exit 0
0 commit comments