<commit_before>#!/bin/sh
# OmniSharp-Roslyn Installer
#
# Works on: Linux, macOS & Cygwin/WSL & MinGW

usage() {
    printf "usage: %s [-HMuh] [-v version] [-l location]\\n" "$0"
}

print_help() {
    cat << EOF
$(usage)

Options:
    -v <version>  | Version to install (if omitted, fetch latest)
    -l <location> | Directory to install the server to (upon install, this directory will be cleared)
    -u            | Usage info
    -h            | Help message
    -H            | Install the HTTP version of the server
    -M            | Use the system Mono rather than the bundled Mono
EOF
}

get_latest_version() {
    if [ "$(command -v curl)" ]; then
        curl --silent "https://api.github.com/repos/OmniSharp/omnisharp-roslyn/releases/latest"
    elif [ "$(command -v wget)" ]; then
        wget -qO- "https://api.github.com/repos/OmniSharp/omnisharp-roslyn/releases/latest"
    fi | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/'
}

location="$HOME/.omnisharp/"

while getopts v:l:HMuh o "$@"
do
    case "$o" in
        v)      version="$OPTARG";;
        l)      location="$OPTARG";;
        H)      http=".http";;
        M)      mono=1;;
        u)      usage && exit 0;;
        h)      print_help && exit 0;;
        [?])    usage && exit 1;;
    esac
done

# Ensure that either 'curl' or 'wget' is installed
if [ ! "$(command -v curl)" ] && [ ! "$(command -v wget)" ]; then
    echo "Error: the installer requires either 'curl' or 'wget'"
    exit 1
fi<commit_msg>Prevent custom curl user-agent strings affecting GitHub JSON response<commit_after>#!/bin/sh
# OmniSharp-Roslyn Installer
#
# Works on: Linux, macOS & Cygwin/WSL & MinGW

usage() {
    printf "usage: %s [-HMuh] [-v version] [-l location]\\n" "$0"
}

print_help() {
    cat << EOF
$(usage)

Options:
    -v <version>  | Version to install (if omitted, fetch latest)
    -l <location> | Directory to install the server to (upon install, this directory will be cleared)
    -u            | Usage info
    -h            | Help message
    -H            | Install the HTTP version of the server
    -M            | Use the system Mono rather than the bundled Mono
EOF
}

get_latest_version() {
    if [ "$(command -v curl)" ]; then
        curl --user-agent "curl" --silent "https://api.github.com/repos/OmniSharp/omnisharp-roslyn/releases/latest"
    elif [ "$(command -v wget)" ]; then
        wget -qO- "https://api.github.com/repos/OmniSharp/omnisharp-roslyn/releases/latest"
    fi | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/'
}

location="$HOME/.omnisharp/"

while getopts v:l:HMuh o "$@"
do
    case "$o" in
        v)      version="$OPTARG";;
        l)      location="$OPTARG";;
        H)      http=".http";;
        M)      mono=1;;
        u)      usage && exit 0;;
        h)      print_help && exit 0;;
        [?])    usage && exit 1;;
    esac
done

# Ensure that either 'curl' or 'wget' is installed
if [ ! "$(command -v curl)" ] && [ ! "$(command -v wget)" ]; then
    echo "Error: the installer requires either 'curl' or 'wget'"
    exit 1
fi
{'fraction_non_alphanumeric': 0.16, 'fraction_numerical': 0.0045901639344262295, 'mean_word_length': 2.256136606189968, 'pattern_counts': {'":': 2, '<': 11, '<?xml version=': 0, '>': 7, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2243905', 'n_tokens_mistral': 1089, 'n_tokens_neox': 1016, 'n_words': 317}