From 487aab4fb7a5bbe7b168d9eff30af99f9f3ca8b8 Mon Sep 17 00:00:00 2001 From: James Dixon Date: Wed, 30 Nov 2022 12:40:49 -0500 Subject: [PATCH] made remove scripts dir (symlinked to ~/.local/) --- .../scripts/completions/hugoctl_comp.bash | 25 ---- config/scripts/.local/scripts/hugoctl | 125 ------------------ config/scripts/.local/scripts/install_rbenv | 3 - config/scripts/.local/scripts/mc | 3 - 4 files changed, 156 deletions(-) delete mode 100644 config/scripts/.local/scripts/completions/hugoctl_comp.bash delete mode 100755 config/scripts/.local/scripts/hugoctl delete mode 100755 config/scripts/.local/scripts/install_rbenv delete mode 100755 config/scripts/.local/scripts/mc diff --git a/config/scripts/.local/scripts/completions/hugoctl_comp.bash b/config/scripts/.local/scripts/completions/hugoctl_comp.bash deleted file mode 100644 index da570fd..0000000 --- a/config/scripts/.local/scripts/completions/hugoctl_comp.bash +++ /dev/null @@ -1,25 +0,0 @@ -# bash completion for hugctl - -_hugctl_completions() { - local cur - cur="${COMP_WORDS[COMP_CWORD]}" - - local blog_dir="$HOME/src/blog" - case ${COMP_CWORD} in - 1) - OPTS="new list edit serve kill deploy" - compopt -o bashdefault -o default - COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) - ;; - 2) - case ${COMP_CWORD[2]} in - *) - COMPREPLY=($(compgen -W "$(find $blog_dir/content/posts/ -iname '*.md' -type f | xargs -I@ basename @)" -- $cur)); - ;; - esac - ;; - esac - return 0 -} - -complete -F _hugctl_completions hugctl diff --git a/config/scripts/.local/scripts/hugoctl b/config/scripts/.local/scripts/hugoctl deleted file mode 100755 index 170cef2..0000000 --- a/config/scripts/.local/scripts/hugoctl +++ /dev/null @@ -1,125 +0,0 @@ -#!/bin/bash - -# hugoctl -- hugo wrapper script to help manage a hugo blog - -# hugo variables (local machine) -scriptname=$(basename "$0") -blog_dir="$HOME/src/blog" # or the path to your blog -local_url="http://localhost:1313/" -post_filename="" -postname="" -full_post_dir="" -full_post_url="$local_url" - - -set_vars() { - local arg="$1" - - # handle no argument case - if [[ -z "$arg" ]]; then - echo -en "Please enter a post title: " - read -r arg - fi - - # handle extraneous .md file extension - if [[ ! "$arg" =~ .md$ ]]; then - postname="$arg" - else - postname="${arg%???}" - fi - post_filename="$postname.md" - - # hugo post location for server - full_post_dir="$blog_dir/content/posts/$post_filename" - - # url for browser - full_post_url="$local_url/posts/$postname" -} - -hugo_serve() { - xdg-open "$full_post_url" &> /dev/null - hugo serve -s "$blog_dir" -} - -edit_post() { - $EDITOR "$full_post_dir" -} - -new_post() { - hugo new -s "$blog_dir" "posts/$post_filename" - edit_post -} - -deploy_blog() { - if [ -z "$blog_remote_host" ]; then echo "Please set \$blog_remote_host variable"; exit 1; fi - if [ -z "$blog_remote_user" ]; then echo "Please set \$blog_remote_user variable"; exit 1; fi - if [ -z "$blog_remote_dir" ]; then echo "Please set \$blog_remote_dir variable (relative to \$HOME)"; exit 1; fi - - green="$(tput setaf 2)" - reset="$(tput sgr0)" - - printf "%s\n%s\n" "${green}[Deploying]${reset}" "Running \"git pull && hugo\" at \"$blog_remote_user@$blog_remote_host:~/$blog_remote_dir\"..." - - ssh "$blog_remote_user@$blog_remote_host" "(cd \$HOME/$blog_remote_dir && git pull && hugo)" -} - -print_help() { - printf "%s\n" "Usage: " - printf "%s\n\n" "$scriptname [args]" - - printf "%s\n" "Options: " - printf "\t%s:\n\t\t%s\n\n" "new-post (aliases: newpost,np,new,n) [post-name]" "create a new post, open editor and live server" - printf "\t%s:\n\t\t%s\n\n" "edit-post (alises: edit,ep,e) [post-name]" "edit a post in the content directory" - printf "\t%s:\n\t\t%s\n\n" "list-posts (aliases: list,li,lp,ls,l)" "list all posts in content directory" - printf "\t%s:\n\t\t%s\n\n" "list-drafts (alises: listdraft,ld)" "list all posts in content directory" - printf "\t%s:\n\t\t%s\n\n" "server (alises: serve,s)" "serve blog from your blog directory" - printf "\t%s:\n\t\t%s\n\n" "deploy (aliases: dep,d)" "deploy to a remote server" - printf "\n" -} - -if [[ "$#" -lt 1 ]]; then - print_help - exit 1 -fi - -while (($#)); do - case "$1" in - new-post|newpost|np|new|n) - shift - set_vars "$1" - new_post "$1" - break - ;; - edit-post|edit|ep|e) - shift - set_vars "$1" - edit_post "$1" - break - ;; - list-posts|list|li|lp|l|ls) - hugo list -s "$blog_dir" all | cut -d, -f1 | tail -n +2 - # hugo list -s "$blog_dir" all | cut -f1,4 -d, | tail -n +2 | tr ',' ' ' | column -t | sort -hr - break - ;; - list-drafts|listdraft|ld) - hugo list drafts -s "$blog_dir" - break - ;; - server|serve|s) - hugo_serve - break - ;; - deploy|dep|d) - deploy_blog - break - ;; - help|-h|--help) - print_help - break - ;; - *) - print_help - break - ;; - esac -done diff --git a/config/scripts/.local/scripts/install_rbenv b/config/scripts/.local/scripts/install_rbenv deleted file mode 100755 index 01e77e9..0000000 --- a/config/scripts/.local/scripts/install_rbenv +++ /dev/null @@ -1,3 +0,0 @@ -git clone https://github.com/rbenv/rbenv.git ~/.rbenv -mkdir -p ~/.rbenv/plugins -git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build diff --git a/config/scripts/.local/scripts/mc b/config/scripts/.local/scripts/mc deleted file mode 100755 index c7116ab..0000000 --- a/config/scripts/.local/scripts/mc +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -export XMODIFIERS="@im=null" && minecraft-launcher &> /dev/null &