~mil/mepo-devel

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
1

[PATCH] Use XDG_CACHE_HOME consistently

Details
Message ID
<D4DIVY7MGQ07.26SO6E8JSX1MI@gnzler.io>
DKIM signature
pass
Download raw message
Patch: +12 -12
previously only the save/load state scripts actually respected the
variable, which breaks the routeing scripts. which both assume ~/.cache

Signed-off-by: Robert Günzler <r@gnzler.io>
---
 scripts/mepo_ui_menu_pref_stateload.sh    |  2 +-
 scripts/mepo_ui_menu_pref_statesave.sh    |  2 +-
 scripts/mepo_ui_menu_route_graphhopper.sh | 10 +++++-----
 scripts/mepo_ui_menu_route_mobroute.sh    | 10 +++++-----
 4 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/scripts/mepo_ui_menu_pref_stateload.sh b/scripts/mepo_ui_menu_pref_stateload.sh
index ae20341..0976816 100755
--- a/scripts/mepo_ui_menu_pref_stateload.sh
+++ b/scripts/mepo_ui_menu_pref_stateload.sh
@@ -2,7 +2,7 @@
DISPLAYNAME="↺ State: Load"
HOTKEY=u
DOC='
  Loads the state (pins & preferences) from ~/.cache/mepo/savestate.json
  Loads the state (pins & preferences) from $XDG_CACHE_HOME/mepo/savestate.json
'

main() {
diff --git a/scripts/mepo_ui_menu_pref_statesave.sh b/scripts/mepo_ui_menu_pref_statesave.sh
index 4a5bc2d..3dccef8 100755
--- a/scripts/mepo_ui_menu_pref_statesave.sh
+++ b/scripts/mepo_ui_menu_pref_statesave.sh
@@ -2,7 +2,7 @@
DISPLAYNAME="↻ State: Save"
HOTKEY=i
DOC='
  Saves the state (pins & preferences) to ~/.cache/mepo/savestate.json
  Saves the state (pins & preferences) to $XDG_CACHE_HOME/mepo/savestate.json
'

main() {
diff --git a/scripts/mepo_ui_menu_route_graphhopper.sh b/scripts/mepo_ui_menu_route_graphhopper.sh
index 88dda76..e1be865 100755
--- a/scripts/mepo_ui_menu_route_graphhopper.sh
+++ b/scripts/mepo_ui_menu_route_graphhopper.sh
@@ -22,7 +22,7 @@ errdie() {

errcheckhastwopins() {
  NPINS="$(
    cat ~/.cache/mepo/shellpipe_savestate.json |
    cat $XDG_CACHE_HOME/mepo/shellpipe_savestate.json |
      jq "[.[] | select(.cmd == \"pin_add\" and .args.group == $MEPO_PINGROUPACTIVE)] | length"
  )"

@@ -35,12 +35,12 @@ errcheckhastwopins() {

gettablevals() {
  JSONPIN0="$(
    cat ~/.cache/mepo/shellpipe_savestate.json |
    jq "[.[] | select(.cmd == \"pin_add\" and .args.group == $MEPO_PINGROUPACTIVE)] | first"
    cat $XDG_CACHE_HOME/mepo/shellpipe_savestate.json |
      jq "[.[] | select(.cmd == \"pin_add\" and .args.group == $MEPO_PINGROUPACTIVE)] | first"
  )"
  JSONPIN1="$(
    cat ~/.cache/mepo/shellpipe_savestate.json |
    jq "[.[] | select(.cmd == \"pin_add\" and .args.group == $MEPO_PINGROUPACTIVE)] | last"
    cat $XDG_CACHE_HOME/mepo/shellpipe_savestate.json |
      jq "[.[] | select(.cmd == \"pin_add\" and .args.group == $MEPO_PINGROUPACTIVE)] | last"
  )"
  COORDFROM="$(echo "$JSONPIN0" | jq '(.args.lat|tostring) + ", " + (.args.lon|tostring)' |tr -d '"')"
  COORDTO="$(echo "$JSONPIN1" | jq '(.args.lat|tostring) + ", " + (.args.lon|tostring)' |tr -d '"')"
diff --git a/scripts/mepo_ui_menu_route_mobroute.sh b/scripts/mepo_ui_menu_route_mobroute.sh
index 002edfe..486de2a 100755
--- a/scripts/mepo_ui_menu_route_mobroute.sh
+++ b/scripts/mepo_ui_menu_route_mobroute.sh
@@ -40,7 +40,7 @@ ensurehasmobroute() {

errcheckhastwopins() {
  NPINS="$(
    cat ~/.cache/mepo/shellpipe_savestate.json |
    cat $XDG_CACHE_HOME/mepo/shellpipe_savestate.json |
      jq "[.[] | select(.cmd == \"pin_add\" and .args.group == $MEPO_PINGROUPACTIVE)] | length"
  )"

@@ -53,12 +53,12 @@ errcheckhastwopins() {

gettablevals() {
  JSONPIN0="$(
    cat ~/.cache/mepo/shellpipe_savestate.json |
    jq "[.[] | select(.cmd == \"pin_add\" and .args.group == $MEPO_PINGROUPACTIVE)] | first"
    cat $XDG_CACHE_HOME/mepo/shellpipe_savestate.json |
      jq "[.[] | select(.cmd == \"pin_add\" and .args.group == $MEPO_PINGROUPACTIVE)] | first"
  )"
  JSONPIN1="$(
    cat ~/.cache/mepo/shellpipe_savestate.json |
    jq "[.[] | select(.cmd == \"pin_add\" and .args.group == $MEPO_PINGROUPACTIVE)] | last"
    cat $XDG_CACHE_HOME/mepo/shellpipe_savestate.json |
      jq "[.[] | select(.cmd == \"pin_add\" and .args.group == $MEPO_PINGROUPACTIVE)] | last"
  )"
  DATE="$(date -u +'%Y-%m-%dT%H:%M:%SZ')"
  COORDFROM="$(echo "$JSONPIN0" | jq '(.args.lat|tostring) + ", " + (.args.lon|tostring)' |tr -d '"')"

base-commit: c1807b103f9019f647b80294b9001114a5fd3464
-- 
2.44.2
Details
Message ID
<c423fed9-adbf-4372-a3ea-e04d89f31fe5@app.fastmail.com>
In-Reply-To
<D4DIVY7MGQ07.26SO6E8JSX1MI@gnzler.io> (view parent)
DKIM signature
pass
Download raw message
On Mon, Sep 23, 2024, at 4:25 AM, Robert Günzler wrote:
> previously only the save/load state scripts actually respected the
> variable, which breaks the routeing scripts. which both assume ~/.cache
>
> Signed-off-by: Robert Günzler <r@gnzler.io>
> ---
>  scripts/mepo_ui_menu_pref_stateload.sh    |  2 +-
>  scripts/mepo_ui_menu_pref_statesave.sh    |  2 +-
>  scripts/mepo_ui_menu_route_graphhopper.sh | 10 +++++-----
>  scripts/mepo_ui_menu_route_mobroute.sh    | 10 +++++-----
>  4 files changed, 12 insertions(+), 12 deletions(-)

Thanks for sending, lgtm - applied!
Reply to thread Export thread (mbox)