From 0c6b65a9d78a108c465a0a7274600464c24fb39a Mon Sep 17 00:00:00 2001 From: typebrook Date: Fri, 15 May 2020 21:33:06 +0800 Subject: Remove Bash-Snippets related code --- gist | 56 ++------------------------------------------------------ 1 file changed, 2 insertions(+), 54 deletions(-) diff --git a/gist b/gist index 752c7db..31ff937 100755 --- a/gist +++ b/gist @@ -34,8 +34,6 @@ # user, u Get list of gists with a given Github user # github, G Export selected gist as a new Github repo # help, h Show this help message -# version Get the tool version -# update Update Bash-Snippet Tools # # Example: # gist fetch (update the list of gists from github.com) @@ -55,7 +53,6 @@ # TODO codebase statistics, like C++ or something # TODO migrate to gh-page, with install.sh and check_md5 in README -currentVersion="1.23.0" configuredClient="" NAME=${GISTSCRIPT:-$(basename $0)} #show hint and helper message with current script name @@ -73,7 +70,6 @@ fi # Default configuration [[ ! -t 1 && -z $hint ]] && hint=false -auto_sync=true # automatically clone the gist repo protocol=https # Shell configuration @@ -152,50 +148,6 @@ _process_json() { return "$?" } -update() { - # Author: Alexander Epstein https://github.com/alexanderepstein - # Update utility version 2.2.0 - # To test the tool enter in the defualt values that are in the examples for each variable - repositoryName="Bash-Snippets" #Name of repostiory to be updated ex. Sandman-Lite - githubUserName="alexanderepstein" #username that hosts the repostiory ex. alexanderepstein - nameOfInstallFile="install.sh" # change this if the installer file has a different name be sure to include file extension if there is one - latestVersion=$(httpGet https://api.github.com/repos/$githubUserName/$repositoryName/tags | grep -Eo '"name":.*?[^\\]",'| head -1 | grep -Eo "[0-9.]+" ) #always grabs the tag without the v option - - if [[ $currentVersion == "" || $repositoryName == "" || $githubUserName == "" || $nameOfInstallFile == "" ]]; then - echo "Error: update utility has not been configured correctly." >&2 - exit 1 - elif [[ $latestVersion == "" ]]; then - echo "Error: no active internet connection" >&2 - exit 1 - else - if [[ $latestVersion != "$currentVersion" ]]; then - echo "Version $latestVersion available" - echo -n "Do you wish to update $repositoryName [Y/n]: " - read -r answer - if [[ $answer == [Yy] ]]; then - cd ~ || { echo 'Update Failed'; exit 1; } - if [[ -d ~/$repositoryName ]]; then rm -r -f $repositoryName || { echo "Permissions Error: try running the update as sudo"; exit 1; } ; fi - echo -n "Downloading latest version of: $repositoryName." - # shellcheck disable=SC2015 - git clone -q "https://github.com/$githubUserName/$repositoryName" && touch .BSnippetsHiddenFile || { echo "Failure!"; exit 1; } & - while [ ! -f .BSnippetsHiddenFile ]; do { echo -n "."; sleep 2; };done - rm -f .BSnippetsHiddenFile - echo "Success!" - cd $repositoryName || { echo 'Update Failed'; exit 1; } - git checkout "v$latestVersion" 2> /dev/null || git checkout "$latestVersion" 2> /dev/null || echo "Couldn't git checkout to stable release, updating to latest commit." - chmod a+x install.sh #this might be necessary in your case but wasnt in mine. - ./$nameOfInstallFile "update" || exit 1 - cd .. - rm -r -f $repositoryName || { echo "Permissions Error: update succesfull but cannot delete temp files located at ~/$repositoryName delete this directory with sudo"; exit 1; } - else - exit 1 - fi - else - echo "$repositoryName is already the latest version" - fi - fi -} - # Handle configuration cases _configure() { [[ $# == 0 ]] && (${EDITOR:-vi} "$CONFIG") && return 0 @@ -297,7 +249,7 @@ _color_description_title() { # Return git status of a given repo _check_repo_status() { if [[ ! -d $1 ]]; then - if [[ $auto_sync == 'true' ]]; then + if [[ $auto_sync != false ]]; then echo "\e[32m[cloning]\e[0m"; else echo "\e[32m[Not cloned yet]\e[0m"; @@ -455,7 +407,7 @@ _fetch_gists() { sed -i'' -Ee "/^$mark/ d" $INDEX && echo "$result" >> $INDEX hint=$hint _show_list - [[ $auto_sync == 'true' ]] && (_sync_repos &> /dev/null &) + [[ $auto_sync != false ]] && (_sync_repos &> /dev/null &) true } @@ -911,10 +863,6 @@ case "$1" in mark=.; _gists_with_range "$@" ;; last | L) _access_last_index "$@" ;; - version) - echo "Version $currentVersion" ;; - update) - update ;; help | h) usage ;; *) -- cgit v1.2.3-70-g09d2