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

Commit 5bc3b5c

Browse files
authored
Merge pull request #377 from tmc-cli/update-man-jclc
updated install.sh and added instructions
2 parents fce02a0 + c4c5a0d commit 5bc3b5c

File tree

4 files changed

+62
-17
lines changed

4 files changed

+62
-17
lines changed

README.md

Lines changed: 18 additions & 3 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

@@ -23,8 +23,19 @@ TMC-CLI is the command-line client for University of Helsinki's Test My Code -fr
2323

2424
##Installation
2525

26-
Download the latest [release](https://github.com/tmc-cli/tmc-cli/releases/latest).
27-
If you use Linux or OS X, choose "tmc". If you use Windows, choose "tmc-cli-[VERSION].jar".
26+
###Using the install script (Linux/OS X only)
27+
28+
`cd` into the directory where you wish to install TMC-CLI. Then, copy and paste the following command in your terminal:
29+
30+
```
31+
curl -0 https://raw.githubusercontent.com/tmc-cli/tmc-cli/master/scripts/install.sh | bash; source ~/.bashrc
32+
```
33+
34+
TMC-CLI should now be installed. You can try running it with `tmc`.
35+
36+
###Manual installation
37+
38+
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".
2839

2940
If you downloaded "tmc", navigate to the download directory on your terminal and make it executable with `chmod u+x ./tmc`.
3041

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

4859
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`.
4960

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+
5065
##Manual
5166

5267
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`.

docs/MANUAL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ Once submission is successful, a shareable link will be printed.
176176
Do not send a message alongside the paste.
177177

178178
`-m` `--message`
179-
Give the paste as an argument instead of opening a text editor.
179+
Give the message as an argument instead of opening a text editor.
180180

181181
COMMAND: PROP
182182
-------------

docs/tmc.1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.TH TMC\-CLI 1 2016\-06\-30 "Helsinki Univ. Dep. of CS" "TMC\-CLI Manual"
1+
.TH TMC\-CLI 1 2016\-06\-30 "TestMyCode" "TMC\-CLI Manual"
22
.SH NAME
33
.PP
44
tmc \- Command\-line client for TestMyCode
@@ -146,7 +146,7 @@ Open the link to the paste in the default internet browser after submission.
146146
Do not send a message alongside the paste.
147147
.TP
148148
\fB\fC\-m\fR \fB\fC\-\-message\fR
149-
Give the paste as an argument instead of opening a text editor.
149+
Give the message as an argument instead of opening a text editor.
150150
.SH COMMAND: PROP
151151
.PP
152152
\fB\fCtmc\fR \fB\fCprop\fR [\fIKEY\fP] [\fIVALUE\fP] ...
@@ -176,7 +176,7 @@ blue, purple, cyan, white, none.
176176
\fB\fC[course directory]/.tmc.json\fR
177177
Course configuration and cache file. Saves the status of the username, server
178178
address and course's exercises. Manually editing this file may have adverse
179-
effects.
179+
effects.
180180
.TP
181181
\fB\fC~/.config/tmc\-cli/properties.json\fR
182182
User configuration file. Use \fB\fCtmc prop\fR to edit properties.

scripts/install.sh

100644100755
Lines changed: 40 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,44 @@
1-
#bin/sh
1+
#!/bin/bash
22

3-
curl -O https://github.com/tmc-cli/tmc-cli/releases/download/0.6.3/tmc
4-
chmod u+x ./tmc
5-
if ./tmc ;then
6-
echo Error when installing.
7-
exit 1
8-
fi
3+
RCFILE=".bashrc"
4+
RCPATH="$HOME/$RCFILE"
95

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 ""
1010

11-
source $HOME/.bashrc
11+
if [ ! -f $RCPATH ]; then
12+
echo -e "$RCPATH not found, creating"
13+
echo ""
14+
touch $RCPATH
15+
fi
1216

13-
echo Installation complete.
14-
exit 0
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
41+
chmod u+x ./tmc
42+
./tmc > /dev/null
43+
echo "Installation complete"
44+
exit

0 commit comments

Comments
 (0)