diff --git a/Setup.sh b/Setup.sh index de05528..b172633 100755 --- a/Setup.sh +++ b/Setup.sh @@ -103,7 +103,7 @@ Other: Input any path" echo "Ok!" ;; esac - sudo wget -O $INSTALL_PATH/gir https://github.com/Icycoide/Gir/releases/download/v0.2.4/main.sh || echo "FAIL | Either failed download or invalid path or sudo does not exist." + sudo wget -O $INSTALL_PATH/gir https://github.com/Icycoide/Gir/releases/download/v0.2.5/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 754fc1d..40afa0e 100755 --- a/main.sh +++ b/main.sh @@ -2,7 +2,7 @@ function gir.main() { clear - MENU_CHOICE=$(gum filter --header.foreground="#fe640b" --unselected-prefix.foreground="#fe640b" --selected-indicator.foreground="#fe640b" --indicator.foreground="#fe640b" --match.foreground="#fe640b" --prompt="| " --indicator=">" --header="Repository: $PWD ($(git branch | grep "*" | sed 's/* //g'))" --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 file" "Undo commit" "Read file" "Add files to commit" "Remove files from commit" "Commit" "Push changes" "Pull changes" "Stash changes" "Switch branch" "(Destructive) Reset to remote state" "(Re)initialise repository" "Information about current repo" "About" "Quit") + MENU_CHOICE=$(gum filter --header.foreground="#fe640b" --unselected-prefix.foreground="#fe640b" --selected-indicator.foreground="#fe640b" --indicator.foreground="#fe640b" --match.foreground="#fe640b" --prompt="| " --indicator=">" --header="Repository: $PWD ($(git branch | grep "*" | sed 's/* //g'))" --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 file" "Undo commit" "Read file" "Add files to commit" "Remove files from commit" "Commit" "Push changes" "Pull changes" "Stash changes" "Switch branch" "Make new branch" "(Destructive) Reset to remote state" "(Re)initialise repository" "Information about current repo" "About" "Quit") case $MENU_CHOICE in "Time Machine") gir.timemachine @@ -29,15 +29,15 @@ function gir.main() { gum pager < $(gum file --height=5 --selected.foreground="#fe640b" --all --cursor.foreground="#fe640b" --directory.foreground="#fe640b") ;; "Add files to commit") - git add $(ls | gum filter --selected-indicator.foreground="#fe640b" --indicator.foreground="#fe640b" --match.foreground="#fe640b" --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 --header.foreground="#fe640b" --selected-indicator.foreground="#fe640b" --indicator.foreground="#fe640b" --match.foreground="#fe640b" --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") case $GIR_FORCEALL in 1|TRUE|true) - git rm $(ls | gum filter --selected-indicator.foreground="#d20f39" --indicator.foreground="#fe640b" --match.foreground="#fe640b" --no-limit --header "Remove files" --prompt="| " --indicator="> " --selected-prefix "REMOVE " --unselected-prefix " KEEP " --placeholder "Press TAB to select, Enter to confirm...") -f + git rm $(ls | gum filter --header.foreground="#fe640b" --selected-indicator.foreground="#d20f39" --indicator.foreground="#fe640b" --match.foreground="#fe640b" --no-limit --header "Remove files" --prompt="| " --indicator="> " --selected-prefix "REMOVE " --unselected-prefix " KEEP " --placeholder "Press TAB to select, Enter to confirm...") -f ;; *) - git rm $(ls | gum filter --selected-indicator.foreground="#d20f39" --indicator.foreground="#fe640b" --match.foreground="#fe640b" --no-limit --header "Remove files" --prompt="| " --indicator="> " --selected-prefix "REMOVE " --unselected-prefix " KEEP " --placeholder "Press TAB to select, Enter to confirm...") + git rm $(ls | gum filter --header.foreground="#fe640b" --selected-indicator.foreground="#d20f39" --indicator.foreground="#fe640b" --match.foreground="#fe640b" --no-limit --header "Remove files" --prompt="| " --indicator="> " --selected-prefix "REMOVE " --unselected-prefix " KEEP " --placeholder "Press TAB to select, Enter to confirm...") ;; esac ;; @@ -55,7 +55,10 @@ function gir.main() { git stash ;; "Switch branch") - git checkout $(git branch | gum filter --selected-indicator.foreground="#fe640b" --indicator.foreground="#fe640b" --match.foreground="#fe640b" --header "Select branch to switch to" --prompt="| " --indicator="> " | sed 's/* //g' | sed 's/ //g') + git checkout $(git branch | gum filter --header.foreground="#fe640b" --selected-indicator.foreground="#fe640b" --indicator.foreground="#fe640b" --match.foreground="#fe640b" --no-strict --header "Select branch to switch to" --prompt="| " --indicator="> " | sed 's/* //g' | sed 's/ //g') + ;; + "Make new branch") + git checkout -b $(gum input --cursor.foreground="#fe640b" --placeholder "Enter the name of the new branch (no spaces, only hyphens) or leave empty to cancel. (Basing off $(git branch | grep "*"))") ;; "(Re)initialise repository") git init @@ -91,7 +94,7 @@ function gir.timemachine() { 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" --selected.background="#fe640b" --prompt.foreground="#fe640b" || kill -INT $$ - git add $(ls | gum filter --selected-indicator.foreground="#fe640b" --indicator.foreground="#fe640b" --match.foreground="#fe640b" --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 --header.foreground="#fe640b" --selected-indicator.foreground="#fe640b" --indicator.foreground="#fe640b" --match.foreground="#fe640b" --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 } @@ -103,20 +106,19 @@ function gir.editcommit() { function gir.wrongbranch() { gum spin --spinner minidot --title "Undoing last commit..." -- git reset HEAD~ --soft git stash - 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 checkout $(git branch | gum filter --header.foreground="#fe640b" --selected-indicator.foreground="#fe640b" --indicator.foreground="#fe640b" --match.foreground="#fe640b" --no-strict --header "Select the correct branch to commit to" --prompt="| " --indicator="> " | sed 's/* //g' | sed 's/ //g') git stash pop - git add $(ls | gum filter --selected-indicator.foreground="#fe640b" --indicator.foreground="#fe640b" --match.foreground="#fe640b" --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 --header.foreground="#fe640b" --selected-indicator.foreground="#fe640b" --indicator.foreground="#fe640b" --match.foreground="#fe640b" --no-limit --header "Add files" --prompt="| " --indicator="> " --selected-prefix "YES " --unselected-prefix " NO " --placeholder "Press TAB to select, Enter to confirm...") git commit -m } function gir.undocommit() { - SEL_HASH=$(git log --oneline | gum filter --selected-indicator.foreground="#fe640b" --indicator.foreground="#fe640b" --match.foreground="#fe640b" --no-limit --header "Select hash to undo" --prompt="| " --indicator="> " | cut -d' ' -f1) + SEL_HASH=$(git log --oneline | gum filter --header.foreground="#fe640b" --selected-indicator.foreground="#fe640b" --indicator.foreground="#fe640b" --match.foreground="#fe640b" --header "Select hash to undo" --prompt="| " --indicator="> " | cut -d' ' -f1) git revert $SEL_HASH } function gir.undofile() { - git checkout $(git log --oneline | gum filter --selected-indicator.foreground="#fe640b" --indicator.foreground="#fe640b" --match.foreground="#fe640b" --no-limit --header "Select hash to undo" --prompt="| " --indicator="> " | cut -d' ' -f1) -- $(gum file --show-help --all --file --directory --height=5 --selected.foreground="#fe640b" --cursor.foreground="#fe640b" --directory.foreground="#fe640b") + git checkout $(git log --oneline | gum filter --header.foreground="#fe640b" --selected-indicator.foreground="#fe640b" --indicator.foreground="#fe640b" --match.foreground="#fe640b" --header "Select hash to undo" --prompt="| " --indicator="> " | cut -d' ' -f1) -- $(gum file --show-help --all --file --directory --height=5 --selected.foreground="#fe640b" --cursor.foreground="#fe640b" --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")" } @@ -136,11 +138,11 @@ $(git --version) host system kernel: $(uname -sr) learn more about this release at: -https://github.com/Icycoide/Gir/releases/tag/v0.2.4" +https://github.com/Icycoide/Gir/releases/tag/v$GIR_VERSION" } function gir.variables() { - GIR_VERSION=0.2.4 + GIR_VERSION=0.2.5 } gir.variables