Skip to content

Commit

Permalink
Use bash from env; allow empty vars
Browse files Browse the repository at this point in the history
  • Loading branch information
neoascetic committed Mar 12, 2024
1 parent 6ffa88c commit 193bfae
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions jopa
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/bin/bash
#!/usr/bin/env bash

export from=${from:-"$PWD/pages"}
export to=${to:-"$PWD/www"}
export ext=${ext:-"html"}
export indexes=${indexes:-"$from/index.jsh"}
export layout_file=${layout_file:-"layout.jsh"}
export pages=${pages:-"$from/*.jsh"}
export from=${from-"$PWD/pages"}
export to=${to-"$PWD/www"}
export ext=${ext-".html"}
export indexes=${indexes-"$from/index.jsh"}
export layout_file=${layout_file-"layout.jsh"}
export pages=${pages-"$from/*.jsh"}

multiline() { # multiline [markdown] varname << 'JOPA'
if [[ "$#" -eq 2 ]]; then
Expand All @@ -20,7 +20,7 @@ page_id() { echo "_page_env_${1//[^a-zA-Z0-9]/_}"; }
read_page() {
set -a
src="${1##*/}"
target="${src%.*}.$ext"
target="${src%.*}$ext"
source "$1" >&2
}
store_page() { printf -v $(page_id $1) '%s' "$(read_page $1; declare -px)"; }
Expand Down
2 changes: 1 addition & 1 deletion my-jopa
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

source jopa

Expand Down

0 comments on commit 193bfae

Please sign in to comment.