diff options
| author | redtide <redtid3@gmail.com> | 2021-06-23 15:29:25 +0200 |
|---|---|---|
| committer | Francesco <francesco.bbt@gmail.com> | 2021-06-24 22:53:14 +0200 |
| commit | 36ff3b1c765706125ad71e560bdf5791eda85162 (patch) | |
| tree | ba0b437db4f397e7df5b2836757ed08f150fbf91 /dev-utils/run-local | |
| parent | 3f58e554ba8730bf4a6e862e3096a4d13d212288 (diff) | |
| download | lite-xl-36ff3b1c765706125ad71e560bdf5791eda85162.tar.gz lite-xl-36ff3b1c765706125ad71e560bdf5791eda85162.zip | |
Renamed dev-utils directory to scripts
Diffstat (limited to 'dev-utils/run-local')
| -rwxr-xr-x | dev-utils/run-local | 119 |
1 files changed, 0 insertions, 119 deletions
diff --git a/dev-utils/run-local b/dev-utils/run-local deleted file mode 100755 index 1af7fd1c..00000000 --- a/dev-utils/run-local +++ /dev/null @@ -1,119 +0,0 @@ -#!/bin/bash - -set -o errexit - -# accept argument in the form -github_raw_content () { - echo "https://raw.githubusercontent.com/$1" -} - -option_portable=off -option_copy=on -pargs=() -plugins=() -while [[ "$#" -gt 0 ]]; do - case $1 in - -portable) - option_portable=on - ;; - -keep) - option_copy=off - ;; - -plugin=*) - # should be like -plugin=franko/lite-plugins/master/plugins/autowrap.lua - plugins+=("${1#-plugin=}") - ;; - -global) - option_global=on - ;; - -*) - echo "error: unknown option \"$1\"" - exit 1 - ;; - *) - pargs+=("$1") - ;; - esac - shift -done - -if [ "${#pargs[@]}" -lt 1 ]; then - echo "usage: $0 [options] <build-dir>" - exit 1 -fi - -if [[ "$OSTYPE" == "msys"* || "$OSTYPE" == "mingw"* ]]; then - run_windows=yes -fi - -rundir=".run" -if [[ "$OSTYPE" == "darwin"* ]]; then - bindir="$rundir" - datadir="$rundir" -elif [ "$option_portable" == on ]; then - bindir="$rundir" - datadir="$rundir/data" -else - bindir="$rundir/bin" - datadir="$rundir/share/lite-xl" -fi - -userdir="$(realpath "$rundir")" -builddir="${pargs[0]}" - -build_lite () { - echo "running ninja" - ninja -C "$builddir" -} - -copy_lite_build () { - echo "copying lite executable and data" - rm -fr "$rundir" - mkdir -p "$bindir" "$datadir" - if [ ! -z ${run_windows+x} ]; then - cp "$builddir/src/lite.exe" "$bindir" - else - cp "$builddir/src/lite" "$bindir" - fi - for module_name in core plugins colors fonts; do - cp -r "data/$module_name" "$datadir" - done -} - -run_lite () { - if [ ! -z ${option_global+x} ]; then - echo "running \"lite ${pargs[@]:1}\"" - exec "$bindir/lite" "${pargs[@]:1}" - else - echo "running \"lite ${pargs[@]:1}\" with local HOME" - if [ ! -z ${run_windows+x} ]; then - USERPROFILE="$userdir" exec "$bindir/lite" "${pargs[@]:1}" - else - HOME="$userdir" exec "$bindir/lite" "${pargs[@]:1}" - fi - fi -} - -github_raw_content () { - echo "https://raw.githubusercontent.com/$1" -} - -fetch_plugins () { - for name in "$@"; do - local url="$(github_raw_content "$name")" - local modname="${url##*/}" - if [ "$modname" == init.lua ]; then - local m1="${name#*/}" - modname="${m1%%/*}.lua" - fi - echo "installed $name as $modname from $url" - curl --insecure -L "$url" -o "$datadir/plugins/${modname}" - done -} - -if [ $option_copy == on ]; then - build_lite - copy_lite_build -fi -fetch_plugins "${plugins[@]}" -run_lite |
