init commit
This commit is contained in:
@@ -0,0 +1,62 @@
|
|||||||
|
#!/bin/zsh
|
||||||
|
|
||||||
|
CONFIG="$HOME/.config/gclone/gclone.conf"
|
||||||
|
|
||||||
|
# Detect if there is already a default user. If not, set it to quaxlyqueen.
|
||||||
|
if [[ $(grep -c "default-user: " $CONFIG) -gt 0 ]]; then
|
||||||
|
DEFAULT_USER=`grep "default-user: " $CONFIG | cut -d " " -f 2`
|
||||||
|
else
|
||||||
|
echo "default-user: quaxlyqueen" >> $CONFIG
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Catch any invalid input.
|
||||||
|
if [[ $# -eq 0 || $# -gt 2 ]]; then
|
||||||
|
echo "\nImproper usage. Try:"
|
||||||
|
echo "\ngclone [ { owner }/[ repo { -h | --help | --set-default [ username ] } ] ]"
|
||||||
|
echo " gclone gclone"
|
||||||
|
echo " gclone quaxlyqueen/gclone"
|
||||||
|
echo " gclone -h"
|
||||||
|
echo " gclone --help"
|
||||||
|
echo " gclone --set-default quaxlyqueen"
|
||||||
|
|
||||||
|
exit
|
||||||
|
|
||||||
|
# Display help.
|
||||||
|
elif [[ $1 == "-h" || $1 == "--help" ]]; then
|
||||||
|
echo "\nMaking the Git command line tool easier to use with simpler commands."
|
||||||
|
echo "User must provide an argument. This argument is in the format of:"
|
||||||
|
echo " \"owner/repository\""
|
||||||
|
echo "The \"owner/\" portion may be excluded. By default, this will clone from"
|
||||||
|
echo "the owner quaxlyqueen. WIP: This may be configured at \"$CONFIG\"."
|
||||||
|
echo "an example is below."
|
||||||
|
|
||||||
|
echo "\n\ndefault-user: quaxlyqueen"
|
||||||
|
|
||||||
|
echo "\n\nUsage:"
|
||||||
|
echo "gclone [ { owner }/[ repo ] ] { -h | --help | --set-default [ username ] }"
|
||||||
|
echo " gclone gclone"
|
||||||
|
echo " gclone quaxlyqueen/gclone"
|
||||||
|
echo " gclone -h"
|
||||||
|
echo " gclone --help"
|
||||||
|
echo " gclone --set-default quaxlyqueen"
|
||||||
|
|
||||||
|
exit
|
||||||
|
|
||||||
|
# Set the default owner to clone repo's.
|
||||||
|
elif [[ $1 == "--set-default" ]]; then
|
||||||
|
sed -i "/default-user: /c\default-user: $2" $CONFIG
|
||||||
|
echo "\nDefault user has been set to $2"
|
||||||
|
exit
|
||||||
|
|
||||||
|
# Clone a git repo from a specified owner.
|
||||||
|
elif [[ $1 =~ "/" ]]; then
|
||||||
|
git clone https://github.com/$1
|
||||||
|
REPO=`cut $1 -d "/" -f 2`
|
||||||
|
|
||||||
|
# Clone a git repo from the owner. By default, this will be the owner quaxlyqueen.
|
||||||
|
else
|
||||||
|
git clone https://github.com/$DEFAULT_USER/$1
|
||||||
|
REPO=$1
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd $REPO
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/zsh
|
||||||
|
|
||||||
|
git init
|
||||||
|
gh repo create
|
||||||
|
|
||||||
|
git stage -A
|
||||||
|
git commit -m "init commit"
|
||||||
|
git push --set-upstream origin main
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
#!/bin/zsh
|
||||||
|
|
||||||
|
# Dependencies:
|
||||||
|
# quaxlyqueen/scripts/mark
|
||||||
|
|
||||||
|
BOOKMARKS_FILE=~/.bookmarks
|
||||||
|
|
||||||
|
# Catch any invalid input.
|
||||||
|
if [[ $# -eq 0 || $# -gt 1 ]]; then
|
||||||
|
echo "\nImproper usage. Try:"
|
||||||
|
echo "\ngoto [keyword]"
|
||||||
|
echo " goto downloads"
|
||||||
|
echo " goto school"
|
||||||
|
echo " goto portfolio"
|
||||||
|
echo " goto -h"
|
||||||
|
echo " goto --help"
|
||||||
|
|
||||||
|
# Display help.
|
||||||
|
elif [[ $1 == "-h" || $1 == "--help" ]]; then
|
||||||
|
echo "\nImproper usage. Try:"
|
||||||
|
echo "\ngoto [keyword]"
|
||||||
|
echo " goto downloads"
|
||||||
|
echo " goto school"
|
||||||
|
echo " goto portfolio"
|
||||||
|
echo " goto -h"
|
||||||
|
echo " goto --help"
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
# Locate the bookmark.
|
||||||
|
if [ $(grep -c "$1" $BOOKMARKS_FILE) -gt 0 ]; then
|
||||||
|
|
||||||
|
# Go to the bookmark
|
||||||
|
cd $(grep "$1" $BOOKMARKS_FILE | head -n 1)
|
||||||
|
|
||||||
|
# List bookmarks if bookmark was not found.
|
||||||
|
else
|
||||||
|
echo "Bookmark not found. Available bookmarks:"
|
||||||
|
mark -ls
|
||||||
|
fi
|
||||||
|
fi
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
#!/bin/zsh
|
||||||
|
|
||||||
|
# Catch any input that is invalid.
|
||||||
|
if [[ $# -eq 0 || $# -gt 1 ]]; then
|
||||||
|
echo "\nImproper usage. Try:"
|
||||||
|
echo "\ngit-push [ \"message\" | -h | --help ]"
|
||||||
|
echo " git-push \"init commit\""
|
||||||
|
echo " git-push -h"
|
||||||
|
echo " git-push --help"
|
||||||
|
|
||||||
|
exit
|
||||||
|
|
||||||
|
# Display help.
|
||||||
|
elif [[ $1 == "-h" || $1 == "--help" ]]; then
|
||||||
|
echo "\nMaking the Git command line tool easier to use with simpler commands."
|
||||||
|
echo "User must provide an argument. The argument must be wrapped in \"\" symbols."
|
||||||
|
|
||||||
|
echo "\n\nUsage:"
|
||||||
|
echo "\ngit-push [ \"message\" | -h | --help ]"
|
||||||
|
echo " git-push \"init commit\""
|
||||||
|
echo " git-push -h"
|
||||||
|
echo " git-push --help"
|
||||||
|
|
||||||
|
exit
|
||||||
|
|
||||||
|
# Push changes to remote repository.
|
||||||
|
else
|
||||||
|
git stage -A
|
||||||
|
git commit -m "$1"
|
||||||
|
git push
|
||||||
|
fi
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
#!/bin/zsh
|
||||||
|
|
||||||
|
# Catch any invalid input.
|
||||||
|
if [[ $# -eq 0 || $# -gt 2 ]]; then
|
||||||
|
echo "Improper usage: lookup [command] [search term]"
|
||||||
|
echo "Available commands:"
|
||||||
|
echo " user [user]"
|
||||||
|
echo " eg. lookup user quaxlyqueen"
|
||||||
|
echo " repo [user] [repo]"
|
||||||
|
echo " eg. lookup repo quaxlyqueen/dnd"
|
||||||
|
|
||||||
|
# Display help.
|
||||||
|
elif [[ $1 == "-h" || $1 == "--help" ]]; then
|
||||||
|
echo "Available commands:"
|
||||||
|
echo " user [user]"
|
||||||
|
echo " eg. lookup user quaxlyqueen"
|
||||||
|
echo " repo [user] [repo]"
|
||||||
|
echo " eg. lookup repo quaxlyqueen/dnd"
|
||||||
|
echo " -h"
|
||||||
|
echo " --help"
|
||||||
|
|
||||||
|
# Lookup a user.
|
||||||
|
elif [[ $1 == "user" ]]; then
|
||||||
|
firefox https://github.com/$2
|
||||||
|
|
||||||
|
# Lookup a repo.
|
||||||
|
elif [[ $1 == "repo" ]]; then
|
||||||
|
|
||||||
|
# TODO need to implement.
|
||||||
|
firefox https://github.com/$2
|
||||||
|
fi
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Usage: mark [-ls] [-rm number] [-rm number TO number]
|
||||||
|
# Creates a bookmark of the current directory, displays a list of bookmarks if the -ls option is provided
|
||||||
|
BOOKMARKS_FILE=~/.bookmarks
|
||||||
|
|
||||||
|
# Catch case where there are too many arguments.
|
||||||
|
if [[ $# -gt 1 ]]; then
|
||||||
|
echo "Proper usage: mark [ -ls | -rm [ keyword ] ]"
|
||||||
|
echo " eg. mark"
|
||||||
|
echo " eg. mark -ls"
|
||||||
|
echo " eg. mark -rm portfolio"
|
||||||
|
echo " eg. mark -h"
|
||||||
|
echo " eg. mark --help"
|
||||||
|
|
||||||
|
exit
|
||||||
|
|
||||||
|
# Help page
|
||||||
|
elif [[ $1 == "-h" || $1 == "--help" ]]; then
|
||||||
|
echo "\nCreate and manage persistent bookmarks inside of terminal sessions.\n"
|
||||||
|
echo "Usage:"
|
||||||
|
echo " mark"
|
||||||
|
echo " mark -ls"
|
||||||
|
echo " eg. run main"
|
||||||
|
echo " mark -rm"
|
||||||
|
echo " mark -h"
|
||||||
|
echo " mark --help"
|
||||||
|
|
||||||
|
exit
|
||||||
|
|
||||||
|
# Add a bookmark to the bookmarks file.
|
||||||
|
elif [ $# == 0 ]; then
|
||||||
|
echo $(pwd) >> $BOOKMARKS_FILE
|
||||||
|
|
||||||
|
# List bookmarks stored in the bookmarks file.
|
||||||
|
elif [ "$1" == "-ls" ]; then
|
||||||
|
echo "Bookmarks:"
|
||||||
|
cat $BOOKMARKS_FILE
|
||||||
|
|
||||||
|
# Remove a bookmark stored in the bookmarks file.
|
||||||
|
elif [ "$1" == "-rm" ]; then
|
||||||
|
# The user is trying to remove a single bookmark
|
||||||
|
# Check if the bookmark exists
|
||||||
|
if [ $(grep -c "$2" $BOOKMARKS_FILE) -gt 0 ]; then
|
||||||
|
|
||||||
|
# Remove the bookmark
|
||||||
|
sed -i .bak $2d $BOOKMARKS_FILE
|
||||||
|
else
|
||||||
|
echo "Bookmark not found"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Invalid argument, display an error message
|
||||||
|
else
|
||||||
|
echo "Usage: mark [-ls] [-rm [number | number TO number]]"
|
||||||
|
fi
|
||||||
Executable
+128
@@ -0,0 +1,128 @@
|
|||||||
|
#!/bin/zsh
|
||||||
|
|
||||||
|
# Dependencies:
|
||||||
|
# quaxlyqueen/templates
|
||||||
|
#
|
||||||
|
# quaxlyqueen/scripts/mark
|
||||||
|
# quaxlyqueen/scripts/goto
|
||||||
|
# quaxlyqueen/scripts/ginit
|
||||||
|
|
||||||
|
# Supported languages.
|
||||||
|
TYPES=("c", "c-sharp", "java", "js", "go")
|
||||||
|
|
||||||
|
# Catch case where there are too many arguments.
|
||||||
|
if [[ $# -gt 3 ]]; then
|
||||||
|
echo "Improper usage. Try:"
|
||||||
|
echo "\nnewproject { language } { projectname } { -g | --git-project }"
|
||||||
|
echo " newproject"
|
||||||
|
echo " newproject c"
|
||||||
|
echo " newproject c app"
|
||||||
|
echo " newproject c app -g"
|
||||||
|
echo " newproject c app --git-project"
|
||||||
|
echo " newproject -h"
|
||||||
|
echo " newproject --help\n"
|
||||||
|
|
||||||
|
echo "Supported languages: $TYPES"
|
||||||
|
|
||||||
|
exit
|
||||||
|
|
||||||
|
# Help page
|
||||||
|
elif [[ $1 == "-h" || $1 == "--help" ]]; then
|
||||||
|
echo "\nAbstracting away command line tools to create projects in various languages."
|
||||||
|
echo "User can use with or without arguments."
|
||||||
|
echo "With no arguments, 'newproject' will prompt for a supported language, project name,"
|
||||||
|
echo " and if a git repo should be created."
|
||||||
|
echo "Bookmarks the new project directory using the 'mark' script."
|
||||||
|
echo "Detects required tools to use based upon language selected.\n"
|
||||||
|
echo "Usage:"
|
||||||
|
echo "\nnewproject { language } { projectname } { -g | --git-project }"
|
||||||
|
echo " newproject"
|
||||||
|
echo " newproject c"
|
||||||
|
echo " newproject c app"
|
||||||
|
echo " newproject c app -g"
|
||||||
|
echo " newproject c app --git-project"
|
||||||
|
echo " newproject -h"
|
||||||
|
echo " newproject --help\n"
|
||||||
|
|
||||||
|
echo "Supported languages: $TYPES"
|
||||||
|
|
||||||
|
exit
|
||||||
|
|
||||||
|
elif [[ $# -eq 0 ]]; then
|
||||||
|
read "?Language: " LANG
|
||||||
|
read "?Project name: " NAME
|
||||||
|
read "?Git project (y/N): " GIT
|
||||||
|
|
||||||
|
# User provides the project's language.
|
||||||
|
elif [[ $# -eq 1 ]]; then
|
||||||
|
LANG=$1
|
||||||
|
read "?Project name: " NAME
|
||||||
|
read "?Git project (y/N): " GIT
|
||||||
|
|
||||||
|
# User provides arguments for the language and project name.
|
||||||
|
elif [[ $# -eq 2 ]]; then
|
||||||
|
LANG=$1
|
||||||
|
NAME=$2
|
||||||
|
read "?Git project (y/N): " GIT
|
||||||
|
|
||||||
|
# User provides arguments for all fields.
|
||||||
|
elif [[ $# -eq 3 ]]; then
|
||||||
|
LANG=$1
|
||||||
|
NAME=$2
|
||||||
|
GIT=$3
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check if the language the user has provided is supported.
|
||||||
|
if [[ ${TYPES[@]} =~ $LANG ]]; then
|
||||||
|
echo Creating $LANG project $NAME
|
||||||
|
|
||||||
|
# Language unsupported, prompt user to create a Github issue.
|
||||||
|
else
|
||||||
|
read "?Language is not supported. Create a GH issue (y/N): " GH
|
||||||
|
if [[ $GH == "y" || $GH == "" ]]; then
|
||||||
|
gh issue create --web
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Create a new C project.
|
||||||
|
if [[ $LANG == "c" ]]; then
|
||||||
|
cp -r ~/templates/c ./$NAME # Copy the template C file.
|
||||||
|
cd $NAME
|
||||||
|
mark; # Bookmark new project.
|
||||||
|
|
||||||
|
# Create a new C# project with dotnet.
|
||||||
|
elif [[ $LANG == "c-sharp" ]]; then
|
||||||
|
mkdir $NAME
|
||||||
|
cd $NAME
|
||||||
|
mark; # Bookmark new project.
|
||||||
|
dotnet new console # Create a new console app with dotnet.
|
||||||
|
|
||||||
|
# Create a new Java project with Gradle.
|
||||||
|
elif [[ $LANG == "java" ]]; then
|
||||||
|
mkdir $NAME;
|
||||||
|
cd $NAME;
|
||||||
|
mark; # Bookmark new project.
|
||||||
|
gradle init
|
||||||
|
|
||||||
|
# Create a new HTML, CSS, JS project.
|
||||||
|
elif [[ $LANG == "html" ]]; then
|
||||||
|
mkdir $NAME;
|
||||||
|
cd $NAME;
|
||||||
|
|
||||||
|
cp -r ~/templates/web/public_html .
|
||||||
|
cd public_html;
|
||||||
|
mark; # Bookmark new project.
|
||||||
|
|
||||||
|
elif [[ $LANG == "js" ]]; then
|
||||||
|
mkdir $NAME;
|
||||||
|
cd $NAME;
|
||||||
|
|
||||||
|
touch main.js;
|
||||||
|
mark; # Bookmark new project.
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If the user indicated the project will be a Git project, then run the ginit script.
|
||||||
|
if [[ $GIT == "-g" || $GIT == "--git-project" ]]; then
|
||||||
|
ginit;
|
||||||
|
fi
|
||||||
@@ -0,0 +1,134 @@
|
|||||||
|
#!/bin/zsh
|
||||||
|
|
||||||
|
# Supported languages.
|
||||||
|
TYPES=("c", "cs", "java", "js", "go")
|
||||||
|
|
||||||
|
# Catch case where there are too many arguments.
|
||||||
|
if [[ $# -gt 1 ]]; then
|
||||||
|
echo "Proper usage: run {file}"
|
||||||
|
echo " eg. run"
|
||||||
|
echo " eg. run main"
|
||||||
|
echo " eg. run -h"
|
||||||
|
echo " eg. run --help"
|
||||||
|
|
||||||
|
exit
|
||||||
|
|
||||||
|
# Help page
|
||||||
|
elif [[ $1 == "-h" || $1 == "--help" ]]; then
|
||||||
|
echo "\nAbstracting away command line tools to compile and run code for various languages."
|
||||||
|
echo "User can use with or without an argument file, the filetype is not needed."
|
||||||
|
echo "With no arguments, 'run' will list available (and supported) files."
|
||||||
|
echo "Additionally, 'run' prompts for and passes command line arguments for a program.\n"
|
||||||
|
echo "Detects required tools to use based upon filetypes.\n"
|
||||||
|
echo "Usage:"
|
||||||
|
echo " run"
|
||||||
|
echo " run [filename]"
|
||||||
|
echo " eg. run main"
|
||||||
|
echo " run -h"
|
||||||
|
echo " run --help\n"
|
||||||
|
echo "Supported languages: $TYPES"
|
||||||
|
|
||||||
|
exit
|
||||||
|
|
||||||
|
# Default state, with a reminder of what files may be launched from based upon the currently supported languages.
|
||||||
|
elif [[ $# -eq 0 ]]; then
|
||||||
|
|
||||||
|
echo "Files that may be launched from:"
|
||||||
|
|
||||||
|
# List files available to launch from.
|
||||||
|
for f in *
|
||||||
|
do
|
||||||
|
TYPE=`echo $f | cut -d "." -f 2`
|
||||||
|
counter=0
|
||||||
|
|
||||||
|
# Only list supported filetypes.
|
||||||
|
if [[ ${TYPES[@]} =~ $TYPE ]]; then
|
||||||
|
counter=$((counter+1)) # Increment counter to indicate the number of results.
|
||||||
|
|
||||||
|
# Format: filename (file type)
|
||||||
|
echo `echo $f | cut -d "." -f 1` "("$TYPE")"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo $counter" available files.\n"
|
||||||
|
|
||||||
|
# Catch case where there are no available files to run and exit.
|
||||||
|
if [[ $counter -eq 0 ]]; then
|
||||||
|
echo "No available files to run. Exiting."
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
read "?Which file would you like to launch from: " TMP
|
||||||
|
|
||||||
|
# Locate file and assign variables associated with the file (name and filetype).
|
||||||
|
for f in *
|
||||||
|
do
|
||||||
|
FILE=`echo $f | cut -d "." -f 1`
|
||||||
|
if [[ $FILE == $TMP ]]; then
|
||||||
|
NAME=$TMP
|
||||||
|
TYPE=`echo $f | cut -d "." -f 2`
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# User has provided the file name.
|
||||||
|
elif [[ $# -eq 1 ]]; then
|
||||||
|
|
||||||
|
# Locate file and assign variables associated with the file (name and filetype).
|
||||||
|
for f in *
|
||||||
|
do
|
||||||
|
FILE=`echo $f | cut -d "." -f 1`
|
||||||
|
if [[ $FILE == $1 ]]; then
|
||||||
|
NAME=$FILE
|
||||||
|
TYPE=`echo $f | cut -d "." -f 2`
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
read "?Arguments: " ARGS
|
||||||
|
|
||||||
|
# Run C app.
|
||||||
|
if [[ $TYPE == "c" ]]; then
|
||||||
|
clear
|
||||||
|
echo "Compiling..."
|
||||||
|
gcc $NAME.c -lm
|
||||||
|
echo "Output..."
|
||||||
|
./a.out $ARGS
|
||||||
|
|
||||||
|
# Run C# app.
|
||||||
|
elif [[ $TYPE == "cs" ]]; then
|
||||||
|
clear
|
||||||
|
echo "Compiling..."
|
||||||
|
mcs -out:$NAME.exe $NAME.cs
|
||||||
|
echo "Output..."
|
||||||
|
mono $NAME.exe
|
||||||
|
|
||||||
|
# Run Java app.
|
||||||
|
elif [[ $TYPE == "java" ]]; then
|
||||||
|
clear
|
||||||
|
CP=.:../lib/*
|
||||||
|
echo "Compiling..."
|
||||||
|
javac -cp $CP *.java
|
||||||
|
echo "Output...";
|
||||||
|
java -cp $CP $NAME $ARGS
|
||||||
|
rm *.class
|
||||||
|
|
||||||
|
# Run JavaScript app.
|
||||||
|
elif [[ $TYPE == "js" ]]; then
|
||||||
|
clear
|
||||||
|
echo "Output..."
|
||||||
|
node $NAME.js
|
||||||
|
|
||||||
|
# Run Golang app.
|
||||||
|
elif [[ $TYPE == "go" ]]; then
|
||||||
|
clear
|
||||||
|
echo "Compiling..."
|
||||||
|
go build
|
||||||
|
echo "Output..."
|
||||||
|
./discordo #TODO: need to dynamically obtain the newly created object file to run and then delete
|
||||||
|
rm discordo
|
||||||
|
|
||||||
|
else
|
||||||
|
read "?Language is not supported. Create a GH issue (y/n, default y): " GH
|
||||||
|
if [[ $GH == "y" || $GH == "" ]]; then
|
||||||
|
echo "Need to implement issue reporting."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
Reference in New Issue
Block a user