Skip to content
This repository was archived by the owner on Jun 3, 2025. It is now read-only.

Commit 1262a15

Browse files
author
jclc
committed
Fixed the install script, updated readme
1 parent a00bb6e commit 1262a15

File tree

2 files changed

+50
-8
lines changed

2 files changed

+50
-8
lines changed

README.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
#tmc-cli
1111

12-
TMC-CLI is the command-line client for University of Helsinki's Test My Code -framework. Test My Code is used by various online programming courses for exercise testing and submission.
12+
TMC-CLI is the command-line client for University of Helsinki's TestMyCode -framework. TestMyCode is used by various online programming courses for exercise testing and submission.
1313

1414
![Demonstration](docs/demo.gif)
1515

@@ -25,15 +25,15 @@ TMC-CLI is the command-line client for University of Helsinki's Test My Code -fr
2525

2626
###Using the install script (Linux/OS X only)
2727

28-
Copy and paste the following command in your terminal:
28+
`cd` into the directory where you wish to install TMC-CLI. Then, copy and paste the following command in your terminal:
2929

3030
```
31-
curl -L0 https://raw.githubusercontent.com/tmc-cli/tmc-cli/master/scripts/install.sh | bash
31+
curl -L0 https://raw.githubusercontent.com/tmc-cli/tmc-cli/master/scripts/install.sh | bash; source ~/.bashrc
3232
```
3333

34-
Now try `source ~/.bashrc` or launching a new terminal - `tmc` should work.
34+
TMC-CLI should now be installed. You can try running it with `tmc`.
3535

36-
###Downloading manually
36+
###Manual installation
3737

3838
Download the latest [release](https://github.com/tmc-cli/tmc-cli/releases/latest). If you use Linux or OS X, choose "tmc". If you use Windows, choose "tmc-cli-[VERSION].jar".
3939

@@ -58,6 +58,10 @@ Tip: On Windows, use `doskey tmc="java -jar [path_to_tmc-cli.jar] $*"` in cmd.ex
5858

5959
Now that you've installed tmc-cli, you can view all available commands by running tmc without arguments or with `tmc --help`. You can also view all available options for commands by running them with the `--help` switch, for example `tmc courses --help`.
6060

61+
##Uninstallation
62+
63+
Delete 'tmc' from the directory where you downloaded it, .tmc-autocomplete.sh from your home directory and remove 'source $HOME/.tmc-autocomplete' from your shell rc file.
64+
6165
##Manual
6266

6367
The Unix man page for tmc-cli is located in docs/tmc.1 in this repository. To view it, open it with `man -l tmc.1`.

scripts/install.sh

100644100755
Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,44 @@
1-
#bin/bash
1+
#!/bin/bash
22

3-
curl -LO https://www.github.com/tmc-cli/tmc-cli/releases/download/0.7.0/tmc > ./tmc
3+
RCFILE=".bashrc"
4+
RCPATH="$HOME/$RCFILE"
5+
6+
echo "~ Installing TMC-CLI ~"
7+
echo "This install script assumes you are using Bash."
8+
echo "If you are using another shell, please add 'source $HOME/.tmc-autocomplete.sh' in your shell's rc file after TMC-CLI has been installed."
9+
echo ""
10+
11+
if [ ! -f $RCPATH ]; then
12+
echo -e "$RCPATH not found, creating"
13+
echo ""
14+
touch $RCPATH
15+
fi
16+
17+
if [ -f $HOME/.tmc-autocomplete.sh ]; then
18+
# If .tmc-autocomplete.sh is already in user's home dir, don't download it
19+
if ! ((grep -Fxq "source $HOME/.tmc-autocomplete.sh" $RCPATH) \
20+
|| (grep -Fxq "source \$HOME/.tmc-autocomplete.sh" $RCPATH) \
21+
|| (grep -Fxq "source ~/.tmc-autocomplete.sh" $RCPATH)); then
22+
echo -e ".tmc-autocomplete already exists in $HOME, but is not sourced in $RCFILE"
23+
echo -e "Adding to $RCPATH"
24+
echo "" >> $RCPATH
25+
echo "source $HOME/.tmc-autocomplete.sh" >> $RCPATH
26+
exit
27+
else
28+
echo "TMC-CLI is already installed. Did you forget to source your rc file?"
29+
echo -e "Try 'source $RCPATH'."
30+
exit
31+
fi
32+
fi
33+
echo "Fetching latest release URL"
34+
URL=$(curl -s https://api.github.com/repos/tmc-cli/tmc-cli/releases/latest | grep '"browser_download_url"' | grep '/tmc"' | head -n 1 | cut -d '"' -f 4)
35+
echo "Downloading TMC-CLI"
36+
curl -LO $URL > ./tmc
37+
if [ ! -f ./tmc ]; then
38+
echo "Error downloading TMC-CLI"
39+
exit 1
40+
fi
441
chmod u+x ./tmc
5-
./tmc
42+
./tmc > /dev/null
43+
echo "Installation complete"
644
exit

0 commit comments

Comments
 (0)