diff --git a/gpush b/gpush index 3e8eb4c..fa61713 100755 --- a/gpush +++ b/gpush @@ -1,10 +1,12 @@ #!/bin/zsh # Catch any input that is invalid. -if [[ $# -eq 0 || $# -gt 1 ]]; then +if [[ $# -eq 0 || ($# -gt 1 && ( $1 != "-l" || $1 != "--local" )) ]]; then echo "\nImproper usage. Try:" echo "\ngpush [ \"message\" | -h | --help ]" echo " gpush \"init commit\"" + echo " gpush -l \"init commit\"" + echo " gpush --local \"init commit\"" echo " gpush -h" echo " gpush --help" @@ -18,11 +20,18 @@ elif [[ $1 == "-h" || $1 == "--help" ]]; then echo "\n\nUsage:" echo "\ngit-push [ \"message\" | -h | --help ]" echo " gpush \"init commit\"" + echo " gpush -l \"init commit\"" + echo " gpush --local \"init commit\"" echo " gpush -h" echo " gpush --help" exit +# Commit changes to local repository. +elif [[ $1 == "-l" || $1 == "--local" ]]; then + git stage -A + git commit -m "$2" + # Push changes to remote repository. else git stage -A diff --git a/gupdate b/gupdate new file mode 100755 index 0000000..6ef54a9 --- /dev/null +++ b/gupdate @@ -0,0 +1,2 @@ +#!/bin/zsh + diff --git a/newproject b/newproject index 91fd37e..c75604c 100755 --- a/newproject +++ b/newproject @@ -8,7 +8,7 @@ # quaxlyqueen/scripts/ginit # Supported languages. -TYPES=("c", "c-sharp", "java", "js", "python", "go") +TYPES=("c", "c-sharp", "java", "js", "t3", "python", "flutter", "go") # Catch case where there are too many arguments. if [[ $# -gt 3 ]]; then @@ -22,7 +22,7 @@ if [[ $# -gt 3 ]]; then echo " newproject -h" echo " newproject --help\n" - echo "Supported languages: $TYPES" + echo "Supported languages/stacks: $TYPES" exit @@ -44,7 +44,7 @@ elif [[ $1 == "-h" || $1 == "--help" ]]; then echo " newproject -h" echo " newproject --help\n" - echo "Supported languages: $TYPES" + echo "Supported languages/stacks: $TYPES" exit @@ -103,7 +103,7 @@ elif [[ $LANG == "java" ]]; then mkdir $NAME; cd $NAME; mark; # Bookmark new project. - gradle7 init + gradle init # Create a new HTML, CSS, JS project. elif [[ $LANG == "html" ]]; then @@ -130,6 +130,13 @@ elif [[ $LANG == "python" ]]; then touch main.py; echo "print(\"hello world!\")" >> main.py; mark; + +# Create a new Flutter/Dart project. +elif [[ $LANG == "flutter" ]]; then + flutter create $NAME + cd $NAME + mark; + fi # If the user indicated the project will be a Git project, then run the ginit script. diff --git a/setup b/setup new file mode 100755 index 0000000..56b49d4 --- /dev/null +++ b/setup @@ -0,0 +1,7 @@ +#!/bin/zsh + +mkdir dev docs downloads pictures school tmp; +sudo pacman -S alacritty android-tools archlinux-keyring aspnet-runtime base blender bluebubbles-desktop-app code dart devhelp devhelp-docs dhcpcd discord docker dotnet-sdk dracut efibootmgr feh firefox flatpak fzf gcc git github-cli godot gradle i3-wm i3lock i3status intel-ucode iwd java-openjfx java-openjfx-doc java-openjfx-src jdk-openjdk jgrasp jre-openjdk keepassxc kubeadm kubectl libreoffice-fresh linux linux-firmware luarocks man-db man-pages maven mono nasm neofetch neovim nerd-fonts-complete-starship net-tools networkmanager network-manager-applet ninja nitrogen nmap npm nvidia obs-studio os-prober php picom pavucontrol pidgin python python-pip reflector rofi rust simplescreenrecorder sof-firmware starship steam sudo tar texinfo thunar tldr typescript unrar vi virtualbox vlc wavpack wget wireshark-cli wl-clipboard xob xorg yarn yay zoom zoxide zsh +git clone https://github.com/quaxlyqueen/notes; +git clone https://github.com/quaxlyqueen/templates; +cd dev; git clone https://github.com/quaxlyqueen/scripts; diff --git a/src/goto b/src/goto new file mode 100755 index 0000000..0aa4d55 Binary files /dev/null and b/src/goto differ diff --git a/src/goto.c b/src/goto.c new file mode 100644 index 0000000..53ccfa2 --- /dev/null +++ b/src/goto.c @@ -0,0 +1,60 @@ +#include +#include +#include +#include +#include + +void error() { + printf("\nImproper usage: goto[ keyword ]\n" + " Usage:\n" + " goto downloads\n" + " goto school\n" + " goto portfolio\n" + " goto -h\n" + " goto --help" + ); +} + +void help() { + printf("\nQuickly navigate to saved bookmarks in the terminal.\n" + " Usage:\n" + " goto downloads\n" + " goto school\n" + " goto portfolio\n" + " goto -h\n" + " goto --help" + ); +} + +void validateDir(char input[]) { + //char * bookmarksFile = strcat(getenv("HOME"), "/.bookmarks"); + char * bookmarksFile = "/home/jashton/.bookmarks"; + FILE * f = fopen(bookmarksFile, "r"); + + // Unable to access file. + if(f == NULL) { + printf("Error accessing file located at %s.\n", bookmarksFile); + return; + } + else { + char cwd[PATH_MAX]; + if(getcwd(cwd, sizeof(cwd)) != NULL) { + printf("cwd: %s\n", cwd); + } + chdir(".."); + printf("cwd: %s", cwd); + } +} + +int main(int argc, char *argv[]) { + + // Invalid number of arguments. + if(argc != 2) { + error(); + return 1; + } + + // Display help. + else if(strcmp(argv[1], "-h") == 0 || strcmp(argv[1], "--help") == 0) help(); + else validateDir(argv[1]); +} diff --git a/src/mark.c b/src/mark.c index 0cfe48c..2c25632 100644 --- a/src/mark.c +++ b/src/mark.c @@ -63,7 +63,7 @@ int main(int argc, char *argv[]) { // Append the current directory to the bookmarks file. else if(argc == 1) { char cwd[PATH_MAX]; - fprintf(f, getcwd(cwd, sizeof(cwd))); + fprintf(f, "%s", getcwd(cwd, sizeof(cwd))); printf("Successfully bookmarked %s.", cwd); } diff --git a/src/test b/src/test new file mode 100755 index 0000000..ac59506 Binary files /dev/null and b/src/test differ diff --git a/src/test.c b/src/test.c new file mode 100644 index 0000000..9e3fefa --- /dev/null +++ b/src/test.c @@ -0,0 +1,9 @@ +#include +#include +#include + +int main() { + printf("%s", getenv("CWD")); + chdir("/home/jashton/dev"); + printf("%s", getenv("CWD")); +}