diff --git a/README.md b/README.md index e03858f..5f299f3 100644 --- a/README.md +++ b/README.md @@ -6,4 +6,6 @@ With the elements of [Gum](https://github.com/charmbracelet/gum) and [Oh Shit, G There's not much else to say.......except that the Setup...at least works -This is licensed under the MIT license \ No newline at end of file +To install, grab the latest Setup.sh from [the latest release](https://github.com/Icycoide/Gir/releases/latest) and run it + +This is licensed under the MIT license diff --git a/Setup.sh b/Setup.sh index 6e48917..6e9a5ad 100755 --- a/Setup.sh +++ b/Setup.sh @@ -15,7 +15,7 @@ main() { case $OPT in Y|y|Yes|YES|yes) echo "Ok!" - inma + inma || echo "FAIL | Installation fail" ;; *) niam || echo "FAIL | Installation fail" @@ -87,8 +87,23 @@ Install Gum through: } inma() { - read -p "What directory should Gir be installed to?" INSTALL_PATH - sudo wget -O $INSTALL_PATH/gir https://github.com/Icycoide/Gir/releases/download/v0.1.0/main.sh || echo "FAIL | Either failed download or invalid path or sudo does not exist." + echo " + 1: /usr/bin/ + 2: /usr/local/bin/ +Other: Input any path" + read -p "What directory should Gir be installed to? >" INSTALL_PATH + case $INSTALL_PATH in + 1) + INSTALL_PATH=/usr/bin + ;; + 2) + INSTALL_PATH=/usr/local/bin + ;; + *) + echo "Ok!" + ;; + esac + sudo wget -O $INSTALL_PATH/gir https://github.com/Icycoide/Gir/releases/download/v0.2.0/main.sh || echo "FAIL | Either failed download or invalid path or sudo does not exist." sudo chmod +x $INSTALL_PATH/gir || echo "FAIL | Either insufficient permissions or file does not exist or sudo does not exist." } diff --git a/main.sh b/main.sh index 59f8004..3a289ef 100755 --- a/main.sh +++ b/main.sh @@ -3,7 +3,7 @@ function gir.main() { clear git remote -v - MENU_CHOICE=$(gum choose --header="Current directory: $PWD" "Time Machine" "Add addition to last commit" "Edit last commit's message" "Correct an edit to a different branch" "Diff with fancy flag" "Undo commit" "Read file" "Add files to commit" "Commit" "Push changes" "Pull changes" "(Destructive) Reset to remote state" "(Re)initialise repository" "Quit") + MENU_CHOICE=$(gum filter --header.foreground="#fab387" --unselected-prefix.foreground="#fab387" --selected-indicator.foreground="#fab387" --indicator.foreground="#fab387" --match.foreground="#fab387" --prompt="| " --indicator=">" --header="Current directory: $PWD" --placeholder="Option" "Time Machine" "Add addition to last commit" "Edit last commit's message" "Correct an edit to a different branch" "Diff with fancy flag" "Undo commit" "Read file" "Add files to commit" "Commit" "Push changes" "Pull changes" "(Destructive) Reset to remote state" "(Re)initialise repository" "Quit") case $MENU_CHOICE in "Time Machine") gir.timemachine @@ -24,17 +24,17 @@ function gir.main() { gir.undocommit ;; "Read file") - gum pager < $(gum file --height=5) + gum pager < $(gum file --height=5 --selected.foreground="#fab387" --all --cursor.foreground="#fab387" --directory.foreground="#fe640b") ;; "Add files to commit") - git add $(ls | gum filter --no-limit --header "Add files" --prompt="| " --indicator="> " --selected-prefix "YES " --unselected-prefix " NO " --placeholder "Press TAB to select, Enter to confirm...") + git add $(ls | gum filter --selected-indicator.foreground="#fab387" --indicator.foreground="#fab387" --match.foreground="#fab387" --no-limit --header "Add files" --prompt="| " --indicator="> " --selected-prefix "YES " --unselected-prefix " NO " --placeholder "Press TAB to select, Enter to confirm...") ;; "Remove files from commit") - git rm $(ls | gum filter --no-limit --header "Add files" --prompt="| " --indicator="> " --selected-prefix "YES " --unselected-prefix " NO " --placeholder "Press TAB to select, Enter to confirm...") + git rm $(ls | gum filter --selected-indicator.foreground="#fab387" --indicator.foreground="#fab387" --match.foreground="#fab387" --no-limit --header "Add files" --prompt="| " --indicator="> " --selected-prefix "YES " --unselected-prefix " NO " --placeholder "Press TAB to select, Enter to confirm...") ;; "Commit") - git commit -m "$(gum input --width 50 --placeholder "Summary of changes")" \ - -m "$(gum write --width 80 --placeholder "Details of changes")" + git commit -m "$(gum input --cursor.foreground="#fab387" --width 50 --placeholder "Summary of changes")" \ + -m "$(gum write --cursor.foreground="#fab387" --width 80 --placeholder "Details of changes")" ;; "Push changes") git push @@ -46,7 +46,7 @@ function gir.main() { git init ;; "(Destructive) Reset to remote state") - gum confirm "You are about to reset this repository to the remote state, which will delete all untracked files and overwrite everything with whatever is stored remotely. Are you sure?" --affirmative="Yes, reset!" --negative="No, I changed my mind." --prompt.foreground="#d20f39" && gum spin --spinner minidot --title "Resetting repository to remote state..." -- gir.reset || echo "Operation cancelled." + gum confirm "You are about to reset this repository to the remote state, which will delete all untracked files and overwrite everything with whatever is stored remotely. Are you sure?" --affirmative="Yes, reset!" --negative="No, I changed my mind." --prompt.foreground="#d20f39" --selected.background="#d20f39" && gum spin --spinner minidot --title "Resetting repository to remote state..." -- gir.reset || echo "Operation cancelled." ;; "Quit") exit @@ -60,20 +60,20 @@ function gir.timemachine() { git reflog LINE_COUNT=$(git reflog | wc -l) MAX_OUT=$(($LINE_COUNT - 1)) - INDEX=$(gum input --placeholder "Select the index to reset to...") + INDEX=$(gum input --cursor.foreground="#fab387" --placeholder "Select the index to reset to...") clear git reflog | grep "HEAD@{$INDEX}" - gum confirm "Selected index is $INDEX. Are you sure you want to time travel back to it?" && git reset HEAD@{$INDEX} || echo "Operation cancelled." + gum confirm "Selected index is $INDEX. Are you sure you want to time travel back to it?" --selected.background="#fab387" --prompt.foreground="#fab387" && git reset HEAD@{$INDEX} || echo "Operation cancelled." } function gir.tecommit() { - gum confirm "Are you sure you want to amend the last commit? It is not recommended to do this with public commits" || kill -INT $$ - git add $(ls | gum filter --no-limit --header "Add files" --prompt="| " --indicator="> " --selected-prefix "YES " --unselected-prefix " NO " --placeholder "Press TAB to select, Enter to confirm...") + gum confirm "Are you sure you want to amend the last commit? It is not recommended to do this with public commits" --selected.background="#fab387" --prompt.foreground="#fab387" || kill -INT $$ + git add $(ls | gum filter --selected-indicator.foreground="#fab387" --indicator.foreground="#fab387" --match.foreground="#fab387" --no-limit --header "Add files" --prompt="| " --indicator="> " --selected-prefix "YES " --unselected-prefix " NO " --placeholder "Press TAB to select, Enter to confirm...") git commit --amend --no-edit } function gir.editcommit() { - gum confirm "Are you sure you want to amend the last commit? It is not recommended to do this with public commits" || kill -INT $$ + gum confirm "Are you sure you want to amend the last commit? It is not recommended to do this with public commits" --selected.background="#fab387" --prompt.foreground="#fab387" || kill -INT $$ git commit --amend } @@ -83,7 +83,7 @@ function gir.wrongbranch() { CORRECT_BRANCH=$(gum input --placeholder "Input the name of the correct branch") gum spin --spinner minidot --title "Running git checkout..." -- git checkout $CORRECT_BRANCH git stash pop - git add $(ls | gum filter --no-limit --header "Add files" --prompt="| " --indicator="> " --selected-prefix "YES " --unselected-prefix " NO " --placeholder "Press TAB to select, Enter to confirm...") + git add $(ls | gum filter --selected-indicator.foreground="#fab387" --indicator.foreground="#fab387" --match.foreground="#fab387" --no-limit --header "Add files" --prompt="| " --indicator="> " --selected-prefix "YES " --unselected-prefix " NO " --placeholder "Press TAB to select, Enter to confirm...") git commit -m } @@ -93,7 +93,9 @@ function gir.undocommit() { } function gir.undofile() { - git checkout $(git log --oneline | gum filter | cut -d' ' -f1) -- $(gum file --show-help --all --file --directory --height=5) + git checkout $(git log --oneline | gum filter --selected-indicator.foreground="#fab387" --indicator.foreground="#fab387" --match.foreground="#fab387" --no-limit --header "Select hash to undo" --prompt="| " --indicator="> " | cut -d' ' -f1) -- $(gum file --show-help --all --file --directory --height=5 --selected.foreground="#fab387" --cursor.foreground="#fab387" --directory.foreground="#fe640b") + git commit -m "$(gum input --width 50 --placeholder "Summary of changes (wow you didnt even have to copy-paste to undo)")" \ + -m "$(gum write --width 80 --placeholder "Details of changes")" } function gir.reset() { @@ -104,3 +106,6 @@ function gir.reset() { } gir.main + +# --no-limit --header "Add files" --prompt="| " --indicator="> " --selected-prefix "YES " --unselected-prefix " NO " --placeholder "Press TAB to select, Enter to confirm..." +# --no-limit --header "Select hash to undo" --prompt="| " --indicator="> "