dotfiles

configuration files for shell, text editor, graphical environment, etc.
git clone git://src.adamsgaard.dk/dotfiles
Log | Files | Refs | README | LICENSE Back to index

commit 5fed6b41ddd30bfbcf45126788a9d7fee46998f3
parent 5cd0f29b792f441753700073cdd94cdd6c12493f
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date:   Thu, 29 Aug 2019 11:01:46 +0200

Add -g|--get options to upload

Diffstat:
M.config/openttd/openttd.cfg | 6+++---
M.local/bin/upload | 22++++++++++++++++++----
2 files changed, 21 insertions(+), 7 deletions(-)

diff --git a/.config/openttd/openttd.cfg b/.config/openttd/openttd.cfg @@ -58,14 +58,14 @@ town_council_tolerance = 0 [game_creation] town_name = english -landscape = temperate +landscape = toyland snow_line_height = 15 starting_year = 1950 land_generator = 1 oil_refinery_limit = 32 tgen_smoothness = 1 variety = 0 -generation_seed = 2957958503 +generation_seed = 2833263075 tree_placer = 2 heightmap_rotation = 0 se_flat_world_height = 1 @@ -329,7 +329,7 @@ persistent_buildingtools = true expenses_layout = false station_gui_group_order = 0 station_gui_sort_by = 0 -station_gui_sort_order = 0 +station_gui_sort_order = 1 missing_strings_threshold = 25 graph_line_thickness = 3 show_date_in_logs = false diff --git a/.local/bin/upload b/.local/bin/upload @@ -24,6 +24,7 @@ show_help() { echo " -r, --resize if an image, resize FILES to fit 800x800 pixels" echo " without changing its width-to-height ratio" echo " -s, --sharpen if an image, sharpen all FILES" + echo " -g, --get get previously uploaded FILES instead of uploading" echo "the optional operations are performed in the order listed above." echo "${0##*/} requires imagemagick and rsync to be installed on the system." } @@ -92,6 +93,10 @@ upload_file() { fi } +download_file() { + curl -OL "https://$host/files_nonpub/$1" +} + die() { printf '%s\n' "$1" >&2 exit 1 @@ -101,6 +106,7 @@ notify=0 border=0 resize=0 sharpen=0 +get=0 while :; do case "$1" in -h|-\?|--help) @@ -123,6 +129,9 @@ while :; do -s|--sharpen) sharpen=1 ;; + -g|--get) + get=1 + ;; --) # end all options shift break @@ -153,9 +162,14 @@ else for f in "$@"; do [ ! -f "$f" ] && die "Error: $f is not a file" - tempfile="$(mktemp)" - cp "$f" "$tempfile" - preprocess_file "$tempfile" "$1" - upload_file "$tempfile" "$(basename "$f")" + + if [ "$get" = 1 ]; then + download_file "$(basename "$f")" + else + tempfile="$(mktemp)" + cp "$f" "$tempfile" + preprocess_file "$tempfile" "$1" + upload_file "$tempfile" "$(basename "$f")" + fi done fi