Commit 3c8d7154 authored by Vitaly Lipatov's avatar Vitaly Lipatov

eget: pretty output for Brave's ipfs command

parent 5aac6828
...@@ -560,11 +560,13 @@ ipfs_cat() ...@@ -560,11 +560,13 @@ ipfs_cat()
elif [ "$ipfs_mode" = "brave" ] ; then elif [ "$ipfs_mode" = "brave" ] ; then
IPFS_CMD="$(get_ipfs_brave)" || fatal "Can't find ipfs command in Brave" IPFS_CMD="$(get_ipfs_brave)" || fatal "Can't find ipfs command in Brave"
IPFS_PRETTY_CMD="~Brave-Browser/$(basename $IPFS_CMD)"
IPFS_API="$ipfs_api_brave" IPFS_API="$ipfs_api_brave"
ipfs_access || fatal "Can't access to Brave IPFS API (Brave browser is not running and IPFS is not activated?)" ipfs_access || fatal "Can't access to Brave IPFS API (Brave browser is not running and IPFS is not activated?)"
elif [ "$ipfs_mode" = "local" ] ; then elif [ "$ipfs_mode" = "local" ] ; then
IPFS_CMD="$(print_command_path ipfs)" || fatal "Can't find ipfs command" IPFS_CMD="$(print_command_path ipfs)" || fatal "Can't find ipfs command"
IPFS_PRETTY_CMD="$IPFS_CMD"
IPFS_API="$ipfs_api_local" IPFS_API="$ipfs_api_local"
ipfs_access || fatal "Can't access to IPFS API (ipfs daemon is not running?)" ipfs_access || fatal "Can't access to IPFS API (ipfs daemon is not running?)"
...@@ -602,22 +604,26 @@ ipfs_get() ...@@ -602,22 +604,26 @@ ipfs_get()
{ {
[ -n "$IPFS_CMD" ] || fatal "ipfs api is not usable" [ -n "$IPFS_CMD" ] || fatal "ipfs api is not usable"
if [ -n "$2" ] ; then if [ -n "$2" ] ; then
docmd $IPFS_CMD --api $IPFS_API get -o "$2" "$1" showcmd $IPFS_PRETTY_CMD --api $IPFS_API get -o "$2" "$1"
$IPFS_CMD --api $IPFS_API get -o "$2" "$1"
else else
docmd $IPFS_CMD --api $IPFS_API get "$1" showcmd $IPFS_PRETTY_CMD --api $IPFS_API get "$1"
$IPFS_CMD --api $IPFS_API get "$1"
fi fi
} }
ipfs_put() ipfs_put()
{ {
[ -n "$IPFS_CMD" ] || fatal "ipfs api is not usable" [ -n "$IPFS_CMD" ] || fatal "ipfs api is not usable"
docmd $IPFS_CMD --api $IPFS_API add "$@" showcmd $IPFS_PRETTY_CMD --api $IPFS_API add "$@"
$IPFS_CMD --api $IPFS_API add "$@"
} }
ipfs_cat() ipfs_cat()
{ {
[ -n "$IPFS_CMD" ] || fatal "ipfs api is not usable" [ -n "$IPFS_CMD" ] || fatal "ipfs api is not usable"
docmd $IPFS_CMD --api $IPFS_API cat "$1" showcmd $IPFS_PRETTY_CMD --api $IPFS_API cat "$1"
$IPFS_CMD --api $IPFS_API cat "$1"
} }
fi fi
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment