diff --git a/goto b/goto deleted file mode 100755 index 38ea43c..0000000 --- a/goto +++ /dev/null @@ -1,41 +0,0 @@ -#!/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 diff --git a/newproject b/newproject index c75604c..7571ff6 100755 --- a/newproject +++ b/newproject @@ -8,7 +8,7 @@ # quaxlyqueen/scripts/ginit # Supported languages. -TYPES=("c", "c-sharp", "java", "js", "t3", "python", "flutter", "go") +TYPES=("c", "rust", "c-sharp", "java", "js", "t3", "python", "flutter", "go") # Catch case where there are too many arguments. if [[ $# -gt 3 ]]; then @@ -91,6 +91,15 @@ if [[ $LANG == "c" ]]; then cp -r ~/templates/c/main.c . # Copy the template C file. mark; # Bookmark new project. +# Create a new Rust project. +elif [[ $LANG == "rust" ]]; then + read "?Is this an Arduino project? (y/N): " ARDUINO + if [[ $ARDUINO == "y" ]]; then + cargo generate --git https://github.com/Rahix/avr-hal-template.git + else + cargo new $NAME + fi + # Create a new C# project with dotnet. elif [[ $LANG == "c-sharp" ]]; then mkdir $NAME @@ -137,6 +146,10 @@ elif [[ $LANG == "flutter" ]]; then cd $NAME mark; +# Create a new t3 web app. +elif [[ $LANG == "t3" ]]; then + npm create t3-app@latest + fi # If the user indicated the project will be a Git project, then run the ginit script. diff --git a/run b/run index 966c1c8..2120486 100755 --- a/run +++ b/run @@ -1,7 +1,7 @@ #!/bin/zsh # Supported languages. -TYPES=("c", "cs", "java", "js", "python", "flutter", "gradle", "go") +TYPES=("c", "rs", "cs", "java", "js", "python", "flutter", "gradle", "go") # Catch case where there are too many arguments. if [[ $# -gt 1 ]]; then @@ -99,6 +99,11 @@ if [[ $TYPE == "c" ]]; then rm a.out +# Run a Rust app. +elif [[ $TYPE == "rs" ]]; then + clear + cargo run + # Run C# app. elif [[ $TYPE == "cs" ]]; then clear diff --git a/src/goto b/src/goto deleted file mode 100755 index 0aa4d55..0000000 Binary files a/src/goto and /dev/null differ diff --git a/src/goto.c b/src/goto.c index 53ccfa2..42dabc4 100644 --- a/src/goto.c +++ b/src/goto.c @@ -42,7 +42,9 @@ void validateDir(char input[]) { printf("cwd: %s\n", cwd); } chdir(".."); - printf("cwd: %s", cwd); + if(getcwd(cwd, sizeof(cwd)) != NULL) { + printf("cwd: %s\n", cwd); + } } } diff --git a/src/test b/src/test deleted file mode 100755 index ac59506..0000000 Binary files a/src/test and /dev/null differ diff --git a/src/test.c b/src/test.c deleted file mode 100644 index 9e3fefa..0000000 --- a/src/test.c +++ /dev/null @@ -1,9 +0,0 @@ -#include -#include -#include - -int main() { - printf("%s", getenv("CWD")); - chdir("/home/jashton/dev"); - printf("%s", getenv("CWD")); -} diff --git a/update-bl b/update-bl index e0cd906..d6d4129 100755 --- a/update-bl +++ b/update-bl @@ -1,25 +1,22 @@ #!/bin/zsh -TARGET_FILE=~/.config/xob/brightness -PIPE=~/.config/xob/xobpipe -OLDNUM=`cut -f1 $TARGET_FILE` - -tail -f $PIPE | xob -s brightness & -if [[ $# -eq 0 ]]; then - NEWNUM=`expr $OLDNUM + 5` -elif [[ $# -eq 1 ]]; then - NEWNUM=$1 -elif [[ $# -eq 2 ]]; then - if [[ $1 -eq "--decrease" ]]; then - CHANGE=`expr 0 - $2` - elif [[ $1 -eq "--increase" ]]; then - CHANGE=$2 - fi - NEWNUM=`expr $OLDNUM + $CHANGE` +tail -f ~/.config/xob/xobpipe | xob -s volume & +if [[ $# -eq 2 ]]; then + CHANGE=$1 + TARGET_FILE=$2 +elif [[ $# -eq 3 ]]; then + CHANGE=`expr 0 - $2` + TARGET_FILE=$3 +else + echo "Improper usage. To increase a value in a file,\nupdate-bl [change] [target_file]." + echo "To decrease a value in a file,\nupdate-bl --decrease [change] [target_file]." fi +OLDNUM=`cut -f1 $TARGET_FILE` +NEWNUM=`expr $OLDNUM + $CHANGE` + if [[ $NEWNUM -le 100 && $NEWNUM -ge 0 ]]; then sed -i "s/$OLDNUM/$NEWNUM/g" $TARGET_FILE brightnessctl set $NEWNUM% - echo $NEWNUM >> $PIPE + echo $NEWNUM >> ~/.config/xob/xobpipe fi