| 1 | #!/bin/bashscip-shell filesystem . . `/bin/bash`. |
| 2 | # |
| 3 | # This script moves ~/.lftp (or $LFTP_HOME) files to XDG directories. |
| 4 | # ~/.lftp should be removed after execution of this script. |
| 5 | # |
| 6 | |
| 7 | src=${LFTP_HOME:-$HOME/.lftp} |
| 8 | if ! [scip-shell system . . `[`. -d "$src" ]; then |
| 9 | echoscip-shell system . . echo. "Nothing to move (no $src directory found)." >&2 |
| 10 | exit 0 |
| 11 | fi |
| 12 | |
| 13 | function movescip-shell shell shell-project 0.0.0 move().() { |
| 14 | testscip-shell system . . test. -a "$src/$1" || return |
| 15 | testscip-shell system . . test. -d "$2" || mkdirscip-shell system . . mkdir. -p "$2" || exit 1 |
| 16 | mvscip-shell system . . mv. "$src/$1" "$2/" |
| 17 | } |
| 18 | |
| 19 | function move_datascip-shell shell shell-project 0.0.0 move_data().() { |
| 20 | movescip-shell shell shell-project 0.0.0 move(). "$1" "${XDG_DATA_HOME:-$HOME/.local/share}/lftp" |
| 21 | } |
| 22 | function move_configscip-shell shell shell-project 0.0.0 move_config().() { |
| 23 | movescip-shell shell shell-project 0.0.0 move(). "$1" "${XDG_CONFIG_HOME:-$HOME/.config}/lftp" |
| 24 | } |
| 25 | function move_cachescip-shell shell shell-project 0.0.0 move_cache().() { |
| 26 | movescip-shell shell shell-project 0.0.0 move(). "$1" "${XDG_CACHE_HOME:-$HOME/.cache}/lftp" |
| 27 | } |
| 28 | |
| 29 | move_datascip-shell shell shell-project 0.0.0 move_data(). bg |
| 30 | move_datascip-shell shell shell-project 0.0.0 move_data(). bookmarks |
| 31 | move_datascip-shell shell shell-project 0.0.0 move_data(). cwd_history |
| 32 | move_cachescip-shell shell shell-project 0.0.0 move_cache(). DHT |
| 33 | move_datascip-shell shell shell-project 0.0.0 move_data(). log |
| 34 | move_configscip-shell shell shell-project 0.0.0 move_config(). rc |
| 35 | move_datascip-shell shell shell-project 0.0.0 move_data(). rl_history |
| 36 | move_datascip-shell shell shell-project 0.0.0 move_data(). transfer_log |
| 37 | |
| 38 | rmdirscip-shell system . . rmdir. "$src" |