From a7a4eeb40cd5780bdcbc36bf9c85e558846aead5 Mon Sep 17 00:00:00 2001 From: typebrook Date: Wed, 5 Feb 2020 10:57:04 +0800 Subject: update --- alias | 4 +++- scripts/gist | 8 ++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/alias b/alias index b780cfe..1d839e4 100644 --- a/alias +++ b/alias @@ -220,7 +220,9 @@ alias m='mutt' # misc alias foo='echo bar > foo && echo File foo is created && ls -lh foo' alias bar='echo foo > bar && echo File bar is created && ls -lh bar' -alias token="cd $SETTING_DIR/tokens && ls -lh" +token() { + cd $SETTING_DIR/tokens && cat $1 +} alias gr='_grepString' _grepString() { grep -R $1 . diff --git a/scripts/gist b/scripts/gist index 5c62a18..20e8f06 100755 --- a/scripts/gist +++ b/scripts/gist @@ -97,8 +97,7 @@ _validate_config(){ echo 'Hi fellow! To access your gists, I need your Github username' echo "Also a personal token with scope which allows "gist"!'" echo - _ask_username - _ask_token + _ask_username && _ask_token && init=true elif [[ -z $token && $1 =~ ^(n|new|e|edit|D|delete)$ ]]; then if ! (_ask_token); then echo 'To create/edit/delete a gist, a token is needed' @@ -180,10 +179,10 @@ _show_list() { # if there is a commit not yet push, show red message "ahead" [[ -n $(cd $repo && git cherry) ]] 2>/dev/null && extra="\e[31m[ahead]\e[0m" && occupy=7 - echo -e "$(printf "% 3s" $index) $link $name $file_num $extra $(echo $description | cut -c -$(( 60 -$occupy -1 )) )" + echo -e "$(printf "% 3s" $index)" $link $name $file_num $extra $(echo $description | cut -c -$(( 60 -$occupy -1 )) ) done < $INDEX \ | sed "$filter" - echo -e '\nrun "gist help" for more details' > /dev/null + echo -e '\nrun "gist help" for more details' > /dev/tty } # parse JSON from STDIN with string of commands @@ -449,6 +448,7 @@ usage() { } getConfiguredClient +if [[ $init ]]; then _update; exit 0; fi case "$1" in "") _show_list ;; -- cgit v1.2.3-70-g09d2