~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 mepo] Silence curl's progress bar

Details
Message ID
<20240605032829.30583-2-cnx@loang.net>
DKIM signature
pass
Download raw message
Patch: +9 -9
---
I have a déjà vu discussing this before but could not find the log,
should it be something like mepo_dl_helper.sh instead?
 scripts/mepo_dl.sh                             | 2 +-
 scripts/mepo_ui_menu_reposition_nominatim.sh   | 2 +-
 scripts/mepo_ui_menu_route_graphhopper.sh      | 4 ++--
 scripts/mepo_ui_menu_route_overpassrelation.sh | 2 +-
 scripts/mepo_ui_menu_search_nominatim.sh       | 4 ++--
 scripts/mepo_ui_menu_search_overpass.sh        | 2 +-
 scripts/mepo_ui_menu_user_pin_updater.sh       | 2 +-
 7 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/scripts/mepo_dl.sh b/scripts/mepo_dl.sh
index 6f84bc4523ec..b5bc0b9816d2 100755
--- a/scripts/mepo_dl.sh
+++ b/scripts/mepo_dl.sh
@@ -48,7 +48,7 @@ nominatim_spec() {
  LOCATION="$(prompt Location: | sed 's/ /%20/g')"

  OPTIONS="$(
    curl "https://nominatim.openstreetmap.org/search?format=json&q=$LOCATION" |
    curl -Ss "https://nominatim.openstreetmap.org/search?format=json&q=$LOCATION" |
      jq  '.[] | select(.osm_type == "relation") | "\(.display_name) \(.boundingbox)" ' |
      tr -d '\]\[\\"' |
      sed -E 's/([^ ]+)$/ | \1/g' |
diff --git a/scripts/mepo_ui_menu_reposition_nominatim.sh b/scripts/mepo_ui_menu_reposition_nominatim.sh
index 639f8235a684..bceb140c9015 100755
--- a/scripts/mepo_ui_menu_reposition_nominatim.sh
+++ b/scripts/mepo_ui_menu_reposition_nominatim.sh
@@ -37,7 +37,7 @@ main() {
  echo "$QUERY" | grep -q . || err "Blank search query"

  RESULT="$(
    curl "${MEPO_ENDPOINT_NOMINATIM_SEARCH}?format=json&q=$QUERY" |
    curl -Ss "${MEPO_ENDPOINT_NOMINATIM_SEARCH}?format=json&q=$QUERY" |
      jq '.[] | "\(.display_name) \(.lat) \(.lon)" ' |
      PROMPT="Pick result" mepo_ui_helper_menu.sh 
  )"
diff --git a/scripts/mepo_ui_menu_route_graphhopper.sh b/scripts/mepo_ui_menu_route_graphhopper.sh
index a523c4b0548d..7d681b458f29 100755
--- a/scripts/mepo_ui_menu_route_graphhopper.sh
+++ b/scripts/mepo_ui_menu_route_graphhopper.sh
@@ -36,7 +36,7 @@ nominatimquerytargetmenu() {

    VIEWBOX="$MEPO_TL_LON,$MEPO_TL_LAT,$MEPO_BR_LON,$MEPO_BR_LAT"
    RESULT="$(
      curl "${MEPO_ENDPOINT_NOMINATIM_SEARCH}?format=json&q=$QUERY&viewbox=$VIEWBOX&bounded=1&limit=50" |
      curl -Ss "${MEPO_ENDPOINT_NOMINATIM_SEARCH}?format=json&q=$QUERY&viewbox=$VIEWBOX&bounded=1&limit=50" |
        jq '.[] | "\(.display_name) \(.lat) \(.lon)" '
    )"

@@ -67,7 +67,7 @@ curlgraphhopper() {
  DESTLAT="$(echo "$DEST" | cut -d " " -f1)"
  DESTLON="$(echo "$DEST" | cut -d " " -f2)"

  curl \
  curl -Ss \
    -X POST \
    -H "Content-Type: application/json" \
    "${MEPO_ENDPOINT_GRAPHHOPPER_ROUTE}?key=$MEPO_APIKEY_GRAPHHOPPER" \
diff --git a/scripts/mepo_ui_menu_route_overpassrelation.sh b/scripts/mepo_ui_menu_route_overpassrelation.sh
index 74138f7416de..b8d568c6ec21 100755
--- a/scripts/mepo_ui_menu_route_overpassrelation.sh
+++ b/scripts/mepo_ui_menu_route_overpassrelation.sh
@@ -31,7 +31,7 @@ main() {
  )"

  JSON_RESULTS="$(
    curl "${MEPO_ENDPOINT_OVERPASS}" --data-raw "data=
    curl -Ss "${MEPO_ENDPOINT_OVERPASS}" --data-raw "data=
      [out:json][timeout:25];
      rel(${RELATIONID});
      (._;>>;);
diff --git a/scripts/mepo_ui_menu_search_nominatim.sh b/scripts/mepo_ui_menu_search_nominatim.sh
index 02ed3ab48087..ddf637d976f8 100755
--- a/scripts/mepo_ui_menu_search_nominatim.sh
+++ b/scripts/mepo_ui_menu_search_nominatim.sh
@@ -11,7 +11,7 @@ DOC='
[ -z "$MEPO_ENDPOINT_OSM_WIKI_SPECIALPHRASES" ] && MEPO_ENDPOINT_OSM_WIKI_SPECIALPHRASES='https://wiki.openstreetmap.org/wiki/Special:Export/Nominatim/Special_Phrases/EN'

nominatimspecialphrasesfromwiki() {
  curl "$MEPO_ENDPOINT_OSM_WIKI_SPECIALPHRASES" |
  curl -Ss "$MEPO_ENDPOINT_OSM_WIKI_SPECIALPHRASES" |
    grep '^| ' |
    grep -v '| -' |
    sed -E 's/\|\|.+$//g' |
@@ -33,7 +33,7 @@ main() {

  VIEWBOX="$MEPO_TL_LON,$MEPO_TL_LAT,$MEPO_BR_LON,$MEPO_BR_LAT"
  JSONRESULTS="$(
    curl "${MEPO_ENDPOINT_NOMINATIM_SEARCH}?format=json&q=$QUERY&viewbox=$VIEWBOX&bounded=1&limit=50&extratags=1"
    curl -Ss "${MEPO_ENDPOINT_NOMINATIM_SEARCH}?format=json&q=$QUERY&viewbox=$VIEWBOX&bounded=1&limit=50&extratags=1"
  )"

  echo "
diff --git a/scripts/mepo_ui_menu_search_overpass.sh b/scripts/mepo_ui_menu_search_overpass.sh
index 16b88f86e78f..202d382bbe24 100755
--- a/scripts/mepo_ui_menu_search_overpass.sh
+++ b/scripts/mepo_ui_menu_search_overpass.sh
@@ -12,7 +12,7 @@ DOC='
curloverpass() {
  SCOPE="$(echo "$SCOPE" | cut -d: -f1 | tr '\n' ' ')"
  BBOX="$MEPO_BR_LAT,$MEPO_TL_LON,$MEPO_TL_LAT,$MEPO_BR_LON"
  curl "$MEPO_ENDPOINT_OVERPASS" --data-raw "data=
  curl -Ss "$MEPO_ENDPOINT_OVERPASS" --data-raw "data=
      [out:json][timeout:25];
      (
        node${SCOPE}(${BBOX});
diff --git a/scripts/mepo_ui_menu_user_pin_updater.sh b/scripts/mepo_ui_menu_user_pin_updater.sh
index e6c20311dc5e..0e1f370fda38 100755
--- a/scripts/mepo_ui_menu_user_pin_updater.sh
+++ b/scripts/mepo_ui_menu_user_pin_updater.sh
@@ -17,7 +17,7 @@ DOC='
[ -z "$MEPO_GEOLOCATE_COORDSVIAMETHOD" ] && MEPO_GEOLOCATE_COORDSVIAMETHOD="coordsviageoclue"

coordsviamls() {
  MLSRESULT="$(curl "${MEPO_ENDPOINT_MLS}?key=$MEPO_APIKEY_MLS")"
  MLSRESULT="$(curl -Ss "${MEPO_ENDPOINT_MLS}?key=$MEPO_APIKEY_MLS")"
  LAT="$(echo "$MLSRESULT" | jq '.location.lat')"
  LON="$(echo "$MLSRESULT" | jq '.location.lng')"
  echo "$LAT $LON"
-- 
2.41.0
Details
Message ID
<935baee1-9884-404f-b6dd-9aa99d91a0ef@app.fastmail.com>
In-Reply-To
<20240605032829.30583-2-cnx@loang.net> (view parent)
DKIM signature
pass
Download raw message
On Tue, Jun 4, 2024, at 11:28 PM, Nguyễn Gia Phong wrote:
> ---
> I have a déjà vu discussing this before but could not find the log,
> should it be something like mepo_dl_helper.sh instead?
>  scripts/mepo_dl.sh                             | 2 +-
>  scripts/mepo_ui_menu_reposition_nominatim.sh   | 2 +-
>  scripts/mepo_ui_menu_route_graphhopper.sh      | 4 ++--
>  scripts/mepo_ui_menu_route_overpassrelation.sh | 2 +-
>  scripts/mepo_ui_menu_search_nominatim.sh       | 4 ++--
>  scripts/mepo_ui_menu_search_overpass.sh        | 2 +-
>  scripts/mepo_ui_menu_user_pin_updater.sh       | 2 +-
>  7 files changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/scripts/mepo_dl.sh b/scripts/mepo_dl.sh
> index 6f84bc4523ec..b5bc0b9816d2 100755
> --- a/scripts/mepo_dl.sh
> +++ b/scripts/mepo_dl.sh
> @@ -48,7 +48,7 @@ nominatim_spec() {
>    LOCATION="$(prompt Location: | sed 's/ /%20/g')"
> 
>    OPTIONS="$(
> -    curl 
> "https://nominatim.openstreetmap.org/search?format=json&q=$LOCATION" |
> +    curl -Ss 
> "https://nominatim.openstreetmap.org/search?format=json&q=$LOCATION" |
>        jq  '.[] | select(.osm_type == "relation") | "\(.display_name) 
> \(.boundingbox)" ' |
>        tr -d '\]\[\\"' |
>        sed -E 's/([^ ]+)$/ | \1/g' |
> diff --git a/scripts/mepo_ui_menu_reposition_nominatim.sh 
> b/scripts/mepo_ui_menu_reposition_nominatim.sh
> index 639f8235a684..bceb140c9015 100755
> --- a/scripts/mepo_ui_menu_reposition_nominatim.sh
> +++ b/scripts/mepo_ui_menu_reposition_nominatim.sh
> @@ -37,7 +37,7 @@ main() {
>    echo "$QUERY" | grep -q . || err "Blank search query"
> 
>    RESULT="$(
> -    curl "${MEPO_ENDPOINT_NOMINATIM_SEARCH}?format=json&q=$QUERY" |
> +    curl -Ss "${MEPO_ENDPOINT_NOMINATIM_SEARCH}?format=json&q=$QUERY" |
>        jq '.[] | "\(.display_name) \(.lat) \(.lon)" ' |
>        PROMPT="Pick result" mepo_ui_helper_menu.sh 
>    )"
> diff --git a/scripts/mepo_ui_menu_route_graphhopper.sh 
> b/scripts/mepo_ui_menu_route_graphhopper.sh
> index a523c4b0548d..7d681b458f29 100755
> --- a/scripts/mepo_ui_menu_route_graphhopper.sh
> +++ b/scripts/mepo_ui_menu_route_graphhopper.sh
> @@ -36,7 +36,7 @@ nominatimquerytargetmenu() {
> 
>      VIEWBOX="$MEPO_TL_LON,$MEPO_TL_LAT,$MEPO_BR_LON,$MEPO_BR_LAT"
>      RESULT="$(
> -      curl 
> "${MEPO_ENDPOINT_NOMINATIM_SEARCH}?format=json&q=$QUERY&viewbox=$VIEWBOX&bounded=1&limit=50" 
> |
> +      curl -Ss 
> "${MEPO_ENDPOINT_NOMINATIM_SEARCH}?format=json&q=$QUERY&viewbox=$VIEWBOX&bounded=1&limit=50" 
> |
>          jq '.[] | "\(.display_name) \(.lat) \(.lon)" '
>      )"
> 
> @@ -67,7 +67,7 @@ curlgraphhopper() {
>    DESTLAT="$(echo "$DEST" | cut -d " " -f1)"
>    DESTLON="$(echo "$DEST" | cut -d " " -f2)"
> 
> -  curl \
> +  curl -Ss \
>      -X POST \
>      -H "Content-Type: application/json" \
>      "${MEPO_ENDPOINT_GRAPHHOPPER_ROUTE}?key=$MEPO_APIKEY_GRAPHHOPPER" \
> diff --git a/scripts/mepo_ui_menu_route_overpassrelation.sh 
> b/scripts/mepo_ui_menu_route_overpassrelation.sh
> index 74138f7416de..b8d568c6ec21 100755
> --- a/scripts/mepo_ui_menu_route_overpassrelation.sh
> +++ b/scripts/mepo_ui_menu_route_overpassrelation.sh
> @@ -31,7 +31,7 @@ main() {
>    )"
> 
>    JSON_RESULTS="$(
> -    curl "${MEPO_ENDPOINT_OVERPASS}" --data-raw "data=
> +    curl -Ss "${MEPO_ENDPOINT_OVERPASS}" --data-raw "data=
>        [out:json][timeout:25];
>        rel(${RELATIONID});
>        (._;>>;);
> diff --git a/scripts/mepo_ui_menu_search_nominatim.sh 
> b/scripts/mepo_ui_menu_search_nominatim.sh
> index 02ed3ab48087..ddf637d976f8 100755
> --- a/scripts/mepo_ui_menu_search_nominatim.sh
> +++ b/scripts/mepo_ui_menu_search_nominatim.sh
> @@ -11,7 +11,7 @@ DOC='
>  [ -z "$MEPO_ENDPOINT_OSM_WIKI_SPECIALPHRASES" ] && 
> MEPO_ENDPOINT_OSM_WIKI_SPECIALPHRASES='https://wiki.openstreetmap.org/wiki/Special:Export/Nominatim/Special_Phrases/EN'
> 
>  nominatimspecialphrasesfromwiki() {
> -  curl "$MEPO_ENDPOINT_OSM_WIKI_SPECIALPHRASES" |
> +  curl -Ss "$MEPO_ENDPOINT_OSM_WIKI_SPECIALPHRASES" |
>      grep '^| ' |
>      grep -v '| -' |
>      sed -E 's/\|\|.+$//g' |
> @@ -33,7 +33,7 @@ main() {
> 
>    VIEWBOX="$MEPO_TL_LON,$MEPO_TL_LAT,$MEPO_BR_LON,$MEPO_BR_LAT"
>    JSONRESULTS="$(
> -    curl 
> "${MEPO_ENDPOINT_NOMINATIM_SEARCH}?format=json&q=$QUERY&viewbox=$VIEWBOX&bounded=1&limit=50&extratags=1"
> +    curl -Ss 
> "${MEPO_ENDPOINT_NOMINATIM_SEARCH}?format=json&q=$QUERY&viewbox=$VIEWBOX&bounded=1&limit=50&extratags=1"
>    )"
> 
>    echo "
> diff --git a/scripts/mepo_ui_menu_search_overpass.sh 
> b/scripts/mepo_ui_menu_search_overpass.sh
> index 16b88f86e78f..202d382bbe24 100755
> --- a/scripts/mepo_ui_menu_search_overpass.sh
> +++ b/scripts/mepo_ui_menu_search_overpass.sh
> @@ -12,7 +12,7 @@ DOC='
>  curloverpass() {
>    SCOPE="$(echo "$SCOPE" | cut -d: -f1 | tr '\n' ' ')"
>    BBOX="$MEPO_BR_LAT,$MEPO_TL_LON,$MEPO_TL_LAT,$MEPO_BR_LON"
> -  curl "$MEPO_ENDPOINT_OVERPASS" --data-raw "data=
> +  curl -Ss "$MEPO_ENDPOINT_OVERPASS" --data-raw "data=
>        [out:json][timeout:25];
>        (
>          node${SCOPE}(${BBOX});
> diff --git a/scripts/mepo_ui_menu_user_pin_updater.sh 
> b/scripts/mepo_ui_menu_user_pin_updater.sh
> index e6c20311dc5e..0e1f370fda38 100755
> --- a/scripts/mepo_ui_menu_user_pin_updater.sh
> +++ b/scripts/mepo_ui_menu_user_pin_updater.sh
> @@ -17,7 +17,7 @@ DOC='
>  [ -z "$MEPO_GEOLOCATE_COORDSVIAMETHOD" ] && 
> MEPO_GEOLOCATE_COORDSVIAMETHOD="coordsviageoclue"
> 
>  coordsviamls() {
> -  MLSRESULT="$(curl "${MEPO_ENDPOINT_MLS}?key=$MEPO_APIKEY_MLS")"
> +  MLSRESULT="$(curl -Ss "${MEPO_ENDPOINT_MLS}?key=$MEPO_APIKEY_MLS")"
>    LAT="$(echo "$MLSRESULT" | jq '.location.lat')"
>    LON="$(echo "$MLSRESULT" | jq '.location.lng')"
>    echo "$LAT $LON"
> -- 
> 2.41.0

Makes sense to me, -Ss seems correct as the user will still get a error if
things fail in anycase and this makes things a bit nicer from end-user's
terminal perspective.

Thanks for sending - applied.
Reply to thread Export thread (mbox)