aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorziggys <ziggys@autistici.org>2018-08-02 18:28:31 -0400
committerziggys <ziggys@autistici.org>2018-08-02 18:28:31 -0400
commit9574a85e40177e0700e2e09813268f0833d1fc99 (patch)
treecfd38611f2b65972d5bda25bec8f36cfcb1ee663
parenteb33e130cbe46782fe7dadcd7c78839b8382d96a (diff)
downloadgsocial-cli-9574a85e40177e0700e2e09813268f0833d1fc99.zip
gsocial-cli-9574a85e40177e0700e2e09813268f0833d1fc99.tar
Add command: show | unsigned
-rwxr-xr-xgsocial-cli.sh35
1 files changed, 30 insertions, 5 deletions
diff --git a/gsocial-cli.sh b/gsocial-cli.sh
index 37bdaf5..75d3d4a 100755
--- a/gsocial-cli.sh
+++ b/gsocial-cli.sh
@@ -17,7 +17,7 @@ LICENSE="The Drunken BEER License v 1.1 (https://git.p4g.club/git/beer/about)"
usage () {
test $# = 0 || printf "%s %s\\n" "${SCRIPTNAME}" "$@"
cat << EOF | fold -s
-${SCRIPTNAME} version ${VERSION}
+
by ${AUTHOR}
License: ${LICENSE}
@@ -93,8 +93,6 @@ set_gsf () {
sed -i 's/^'"${OPTION}"'=.*$/'"${OPTION}"'='"${VALUE}"'/' "${GSF}"
fi
- # print some header
- printf "\\e%s%s\\e[0m v%s\\n" "${good_c}" "${SCRIPTNAME}" "${VERSION}"
printf "\\e%ssetting:\\e%s %s=%s\\e[0m\\n\\n" \
"${info_c}" "${good_c}" "${OPTION}" "${VALUE}"
}
@@ -228,6 +226,7 @@ tget () {
&& printf "\\e%sfatal:\\e%s account name not provided\\n\\e[0m" \
"${diee_c}" "${info_c}"
+ test "${informative}" = "yes" && user_info
printf "...retrieving last \\e%s%s\\e[0m statuses from \\e%s%s\\e[0m\\n\\n" \
"${good_c}" "${RETR}" "${good_c}" "${TGET}"
@@ -554,9 +553,10 @@ if [ "$1" = "set" ]; then
set_gsf
elif [ "$1" = "show" ]; then
SHOW="$2"
- sed '/^#/ d; s/[ \t]*$//g' "${GSF}"
+ SHOWARGS="$3"
fi
+
# obtain general settings
sed '/^#/ d; s/[ \t]*$//g' "${GSF}" > "${GSFT}"
d_account="$(sed '/d_account=/ !d; s/d_account=//' "${GSFT}")"
@@ -576,6 +576,32 @@ text_c="$(sed '/text_c=/ !d; s/text_c=//' "${THFT}")"
meta_c="$(sed '/meta_c=/ !d; s/meta_c=//' "${THFT}")"
myself_c="$(sed '/myself_c=/ !d; s/myself_c=//' "${THFT}")"
+# show stuff
+case "${SHOW}" in
+ settings | config)
+if [ -z "${SHOWARGS}" ]; then
+ sed '/^#/ d; s/[ \t]*$//g' "${GSF}"
+else
+ sed '/'"${SHOWARGS}"'/ !d' "${GSF}"
+fi
+ ;;
+accounts | profiles)
+ temporal="$(mktemp -p "${TMPDIR}")"
+ ACCCONFIGS="$(find "${CONFIGD}" | grep "\.config$")"
+ for accconfigs in $ACCCONFIGS; do
+ cat $accconfigs #>> $temporal;
+ done
+
+ # sed '/^#/ d; s/[ \t]*$//g' "${temporal}"
+ ;;
+history | cache)
+ echo "hist"
+ ;;
+commands)
+ echo "comm"
+ ;;
+esac
+
# provide account or use default
if [ "$1" = "-a" ];then
ACCNAME="$2" ;
@@ -604,7 +630,6 @@ NONODE="${NODE##*//}"
HISTORY="${CONFIGD}/${ACCNAME}.history" ;
IUSER="${USER}"
INODE="${NODE}"
-test "${informative}" = "yes" && user_info
# read options from commandline
test "$#" -lt 1 && usage "$@"