Skip to content

Commit b4e35fe

Browse files
author
HoolaBoola
committed
Modified installation instructions and install script. OS and platform now no longer needed as arguments
1 parent 6d35c7c commit b4e35fe

2 files changed

Lines changed: 19 additions & 9 deletions

File tree

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@ To use the software from any directory, you can add it to your environmental var
8080

8181
echo "alias tmc='DIRECTORY/tmc-cli-rust'" >> "$HOME/.bashrc"
8282

83+
#### For macOS
84+
85+
The instructions for Linux **should** work on macOS as well. This has not been tested yet, though, so your mileage may vary.
86+
8387
#### For Windows:
8488

8589
After downloading tmc-cli-rust.exe you can start using it from the command line by navigating to the directory it resides at.
@@ -88,6 +92,12 @@ To be able to use it from any directory, you can add it to your environmental va
8892

8993
set PATH=%PATH%;DIRECTORY
9094

95+
#### Tab-completion from commandline
96+
97+
You can generate shell completion scripts by running `tmc generate-completions --[bash/zsh/powershell] > /path/to/your/completions/directory/filename`. For `bash`, `filename` should be `tmc.bash`. For `zsh`, `_tmc`. This has not yet been tested for Powershell, but the script *should* work if placed in the appropriate directory.
98+
99+
Make sure to have the appropriate software configuration for completions to work. For Zsh and Powershell, completions should be supported by default, but for Bash you may need to install `bash-completion` or similar packages and follow their documentation.
100+
91101
## Commands
92102

93103
tmc [FLAGS] [SUBCOMMAND]

scripts/install.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ echo "~ Installing TMC-CLI ~"
66
echo "(If your shell is not bash, you may have to do the installation manually.)"
77
echo ""
88

9-
if (( $# < 2 )); then
10-
echo "You need to give architecture (x86_64/i686) and OS (mac, linux) as arguments."
11-
exit 1
12-
fi
9+
os="$(uname -s)"
10+
platform="$(uname -m)"
1311

14-
# Get platform-string from first argument, OS from the second
15-
platform=$1
16-
os=$2
12+
if (( $# = 2 )); then
13+
# Get platform-string from first argument, OS from the second
14+
platform=$1
15+
os=$2
16+
fi
1717

1818
echo "Fetching latest version URL from https://download.mooc.fi"
1919
if ! PAGE=$(curl -s https://download.mooc.fi); then
@@ -25,7 +25,7 @@ fi
2525
PAGE=$(echo $PAGE | sed -r 's:</Contents><Contents>:</Contents> <Contents>:g')
2626

2727
fileprefx=""
28-
if [[ "$os" == "mac" ]]; then
28+
if [[ "$os" == "Darwin" ]]; then
2929
fileprefx="tmc-cli-rust-${platform}-apple-darwin-v"
3030
else
3131
fileprefx="tmc-cli-rust-${platform}-unknown-linux-gnu-v"
@@ -95,7 +95,7 @@ elif [ "$SHELLNAME" = "csh" ] || [ "$SHELLNAME" = "tcsh" ]; then
9595
echo "Please add manually variables from $PROFILEFILE to your .cshrc using csh syntax."
9696
else
9797
PROFILEFILE=$HOME/.shrc
98-
echo "Defaulting to .shrc for environment variables, if this is incorrect, please copy these manually to correct file."
98+
echo "Defaulting to .shrc for environment variables. If this is incorrect, please copy these manually to correct file."
9999
fi
100100
# Removes old aliases and such
101101
sed -i '/alias tmc=/d' "$PROFILEFILE"

0 commit comments

Comments
 (0)