this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

refactor!: use `user` instead of `name`+`site`

robin fe180bf6 238ebedf

+21 -34
+21 -34
ebil.sh
··· 30 30 31 31 usage: 32 32 push | push your site files to ebil.club 33 - > ebil push --site robin.ebil.club dist/ 33 + > ebil push --user robin dist/ 34 34 pull | pull your site from ebil.club to a local directory 35 - > ebil pull --site robin.ebil.club site/ 35 + > ebil pull --user robin site/ 36 36 37 37 env: 38 38 you can set certain options using environment variables. 39 39 40 - EBIL_SITE="robin.ebil.club" | --site robin.ebil.club 41 - EBIL_PATH="dist/" | push --from dist/ 42 - pull --to dist/ 43 - EBIL_PATH_REMOTE="root" | push --to root 44 - pull --from root 40 + EBIL_USER="robin" | --user robin.ebil.club 41 + EBIL_PATH="dist/" | push --from dist/ 42 + pull --to dist/ 43 + EBIL_PATH_REMOTE="root" | push --to root 44 + pull --from root 45 45 EBIL_HOST="ebil.club" 46 - EBIL_REMOTE="/var/ebil.club/\${name}/\${site}" 46 + EBIL_REMOTE="/var/ebil.club/\${user}/\${path_remote}" 47 47 48 48 note: 49 49 specify options *before* regular arguments. ··· 56 56 [[ -f .env ]] && export $(grep -v '^#' .env | xargs -0) || return 0 57 57 } 58 58 59 - checksite() { 60 - local site="$1" 61 - local pat='^[a-z]+\.ebil\.club$' 62 - 63 - [[ -z "$site" ]] && die 'site not specified' 64 - [[ "$site" =~ $pat ]] || die 'malformed site url' "(expected form '${pat}'):" "$site" 65 - } 66 - 67 59 checkfrom() { 68 60 [[ -d "$1" ]] || die 'from does not exist' 69 61 } ··· 78 70 } 79 71 80 72 push() { 81 - local site="$1" 73 + local user="$1" 82 74 local from="$2" 83 75 local to="$3" 84 76 local host="$4" 85 77 local remote="$5" 86 - local name 87 78 88 79 from="$(realpath "$from")" 89 80 checkfrom "$from" 90 81 91 82 if [[ ! -n "$remote" ]]; then 92 - checksite "$site" 93 - name="${site%.ebil.club}" 94 - msg 'user:' "$name" 95 - remote="/var/ebil.club/${name}/${site}/${to}" 83 + msg 'user:' "$user" 84 + remote="/var/ebil.club/${user}/${to}" 96 85 fi 97 86 98 87 [[ -f "${from}/index.txt" ]] && msg 'custom curl message configured' "(${from}/index.txt)" 99 88 [[ -f "${from}/index.html" ]] || warn 'index.html not found' "(${from}/index.html)" 100 89 101 - msg 'pushing to' "${site:-${remote}}" 'from' "$from" 90 + msg 'pushing to' "${user}@${host}:${to}" 'from' "$from" 102 91 rcopy "$from" "${host}:${remote}" --delete --chmod=D755,F644 103 92 } 104 93 105 94 pull() { 106 - local site="$1" 95 + local user="$1" 107 96 local from="$2" 108 97 local to="$3" 109 98 local host="$4" ··· 122 111 fi 123 112 124 113 if [[ ! -n "$remote" ]]; then 125 - checksite "$site" 126 - name="${site%.ebil.club}" 127 - msg 'user:' "$name" 128 - remote="/var/ebil.club/${name}/${site}/${from}" 114 + msg 'user:' "$user" 115 + remote="/var/ebil.club/${user}/${from}" 129 116 fi 130 117 131 - msg 'pulling from' "${site:-${remote}}" 'to' "$to" 118 + msg 'pulling from' "${user}@${host}:${from}" 'to' "$to" 132 119 rcopy "${host}:${remote}" "$to" 133 120 } 134 121 135 122 main() { 136 123 sourceenv 137 124 138 - local site="${EBIL_SITE:-}" 125 + local user="${EBIL_USER:-me}" 139 126 local host="${EBIL_HOST:-ebil.club}" 140 127 local remote="${EBIL_REMOTE:-}" 141 128 ··· 151 138 152 139 while [ "$#" -gt 0 ]; do 153 140 case "$1" in 154 - --site) 155 - site="$2" 141 + --user) 142 + user="$2" 156 143 shift 157 144 ;; 158 145 --from) ··· 185 172 [[ -n "${1:-}" ]] && from="$1" 186 173 fi 187 174 188 - push "$site" "$from" "$to" "$host" "$remote" 175 + push "$user" "$from" "$to" "$host" "$remote" 189 176 ;; 190 177 pull) 191 178 from="${EBIL_PATH_REMOTE:-root}" ··· 197 184 [[ -n "${1:-}" ]] && to="$1" 198 185 fi 199 186 200 - pull "$site" "$from" "$to" "$host" "$remote" 187 + pull "$user" "$from" "$to" "$host" "$remote" 201 188 ;; 202 189 '') phelp ;; 203 190 *) die 'command not found' ;;