<commit_before>#!/bin/bash

## -------------------------------------------------------------------------
##  Constants
## -------------------------------------------------------------------------

## Directory for containing various persistent files
WVM_DIR=".wvm"

## Mirror list for package downloads
declare -a WVM_MIRROR_LIST=(
    "http://s1.smx.lt/wvm"
)



## -------------------------------------------------------------------------
##  Private functions
## -------------------------------------------------------------------------

## A silent version of `cat` in pure bash
wvm_cat() {
    local IFS=""
    (
        while read line; do
            echo "${line}"
        done < ${1}
    ) 2>/dev/null
}

wvm_is_sourced() {
    [[ "${FUNCNAME[1]}" == source ]]
}

wvm_check_init() {
    if ! [[ -d "${WVM_DIR}" ]]; then
        echo "Error: Warsow version manager is not initialized."
        echo "Do this so by running 'wvm init'"
        return 2
    fi
}

wvm_get_current_version() {
    if [[ -d "versions/${1}" ]]; then
        wvm_cat ${WVM_DIR}/version
    fi
}

wvm_set_current_version() {
    echo ${1} > ${WVM_DIR}/version
}

wvm_get_current_profile() {
    local version=`wvm_get_current_version`
    if [[ -d "profiles/${version}/${1}" ]]; then
        wvm_cat ${WVM_DIR}/profile
    fi
}

wvm_set_current_profile() {
    echo ${1} > ${WVM_DIR}/profile
}

wvm_get_local_versions() {
    pushd versions > /dev/null
    for server in */; do
        echo -n "${server:0:-1} "
    done
    popd > /dev/null
    echo
}

wvm_get_remote_versions() {
    echo `wvm_cat ${WVM_DIR}/packages.txt | cut -d ' ' -f 1`
}

wvm_init_server() {
    local version=`wvm_get_current_version`
    mkdir -p profiles/${version}/${1}/basewsw
    cat > profiles/${version}/${1}/basewsw/server.cfg <<EOF
set sv_ip ""
set sv_hostname "warsow server"
set sv_port "44400"
set password ""

set logconsole_append "1"<commit_msg>Show each version on new line in wvm list<commit_after>#!/bin/bash

## -------------------------------------------------------------------------
##  Constants
## -------------------------------------------------------------------------

## Directory for containing various persistent files
WVM_DIR=".wvm"

## Mirror list for package downloads
declare -a WVM_MIRROR_LIST=(
    "http://s1.smx.lt/wvm"
)



## -------------------------------------------------------------------------
##  Private functions
## -------------------------------------------------------------------------

## A silent version of `cat` in pure bash
wvm_cat() {
    local IFS=""
    (
        while read line; do
            echo "${line}"
        done < ${1}
    ) 2>/dev/null
}

wvm_is_sourced() {
    [[ "${FUNCNAME[1]}" == source ]]
}

wvm_check_init() {
    if ! [[ -d "${WVM_DIR}" ]]; then
        echo "Error: Warsow version manager is not initialized."
        echo "Do this so by running 'wvm init'"
        return 2
    fi
}

wvm_get_current_version() {
    if [[ -d "versions/${1}" ]]; then
        wvm_cat ${WVM_DIR}/version
    fi
}

wvm_set_current_version() {
    echo ${1} > ${WVM_DIR}/version
}

wvm_get_current_profile() {
    local version=`wvm_get_current_version`
    if [[ -d "profiles/${version}/${1}" ]]; then
        wvm_cat ${WVM_DIR}/profile
    fi
}

wvm_set_current_profile() {
    echo ${1} > ${WVM_DIR}/profile
}

wvm_get_local_versions() {
    pushd versions > /dev/null
    for server in */; do
        echo "${server:0:-1}"
    done
    popd > /dev/null
    echo
}

wvm_get_remote_versions() {
    wvm_cat ${WVM_DIR}/packages.txt | cut -d ' ' -f 1 | sort
}

wvm_init_server() {
    local version=`wvm_get_current_version`
    mkdir -p profiles/${version}/${1}/basewsw
    cat > profiles/${version}/${1}/basewsw/server.cfg <<EOF
set sv_ip ""
set sv_hostname "warsow server"
set sv_port "44400"
set password ""

set logconsole_append "1"
{'fraction_non_alphanumeric': 0.28290155440414505, 'fraction_numerical': 0.010362694300518135, 'mean_word_length': 1.6793893129770991, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4562134', 'n_tokens_mistral': 1258, 'n_tokens_neox': 1225, 'n_words': 284}