Skip to content

Commit 8349d27

Browse files
authored
Merge pull request #54 from joseluisq/fish-autoload-compliant
refactor: fish autoload-compliant
2 parents 5dab658 + 5ac9ff0 commit 8349d27

32 files changed

+362
-331
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,17 @@ jobs:
88
runs-on: ubuntu-latest
99
steps:
1010
- name: Checkout
11-
uses: actions/checkout@v2
11+
uses: actions/checkout@v4
1212
- name: Test
13-
uses: addnab/docker-run-action@v1
13+
uses: addnab/docker-run-action@v3
1414
with:
1515
image: joseluisq/paket
1616
options: -v ${{ github.workspace }}:/gitnow
1717
shell: fish
1818
run: |
1919
fish -v
2020
paket --version
21+
git config --global --add safe.directory /gitnow
2122
paket add /gitnow
2223
/gitnow/testing/test.fish
2324
@@ -26,15 +27,15 @@ jobs:
2627
runs-on: ubuntu-latest
2728
steps:
2829
- name: Checkout
29-
uses: actions/checkout@v2
30+
uses: actions/checkout@v4
3031
- name: Test
31-
uses: addnab/docker-run-action@v1
32+
uses: addnab/docker-run-action@v3
3233
with:
3334
image: joseluisq/paket
3435
options: -v ${{ github.workspace }}:/gitnow
3536
shell: fish
3637
run: |
37-
apk add curl
38+
apk add curl && apk upgrade
3839
curl -sL git.io/fisher | source
3940
fish -v
4041
fisher --version

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/.gitnow
2+
**/.DS_Store

completions/__gitnow_completions.fish

Lines changed: 0 additions & 80 deletions
This file was deleted.

completions/merge.fish

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# GitNow — Speed up your Git workflow. 🐠
2+
# https://github.com/joseluisq/gitnow
3+
4+
# Merge command
5+
6+
__gitnow_load_git_functions
7+
8+
complete -f -x -c merge -a '(__fish_git_branches)'
9+
10+
complete -f -x -c merge \
11+
-s h -l help \
12+
-d "Show information about the options for this command"
13+
14+
complete -f -x -c merge \
15+
-s a -l abort \
16+
-d "Abort conflicted merge"
17+
18+
complete -f -x -c merge \
19+
-s c -l continue \
20+
-d "Continue merge"

completions/move.fish

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# GitNow — Speed up your Git workflow. 🐠
2+
# https://github.com/joseluisq/gitnow
3+
4+
# Move command
5+
6+
__gitnow_load_git_functions
7+
8+
complete -f -x -c move -a '(__fish_git_branches)'
9+
10+
complete -f -x -c move \
11+
-s h -l help \
12+
-d "Show information about the options for this command"
13+
14+
complete -f -x -c move \
15+
-s p -l prev \
16+
-d "Switch to a previous branch using the `--no-apply-stash` option (equivalent to \"move -\")"
17+
18+
complete -f -x -c move \
19+
-s n -l no-apply-stash \
20+
-a '(__fish_git_branches)' \
21+
-d "Switch to a local branch but without applying current stash"
22+
23+
complete -f -x -c move \
24+
-s u -l upstream \
25+
-a '(__fish_git_branches)' \
26+
-d "Fetch a remote branch and switch to it applying current stash"

completions/tag.fish

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# GitNow — Speed up your Git workflow. 🐠
2+
# https://github.com/joseluisq/gitnow
3+
4+
# Tag command
5+
6+
__gitnow_load_git_functions
7+
8+
complete -f -x -c tag \
9+
-d "List all tags in a lexicographic order and treating tag names as versions"
10+
11+
complete -f -x -c tag -a '(__fish_git_tags)'
12+
13+
complete -f -x -c tag \
14+
-s h -l help \
15+
-d "Show information about the options for this command"
16+
17+
complete -f -x -c tag \
18+
-s l -l latest \
19+
-d "Show only the latest Semver release tag version (no suffixed ones or others)"
20+
21+
complete -f -x -c tag \
22+
-s x -l major \
23+
-d "Tag auto-incrementing a major version number"
24+
25+
complete -f -x -c tag \
26+
-s y -l minor \
27+
-d "Tag auto-incrementing a minor version number"
28+
29+
complete -f -x -c tag \
30+
-s z -l patch \
31+
-d "Tag auto-incrementing a patch version number"

conf.d/gitnow.fish

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,25 @@
11
# GitNow — Speed up your Git workflow. 🐠
22
# https://github.com/joseluisq/gitnow
33

4+
set -g gitnow_version 2.11.0
5+
46
# Default global variables
7+
set -q GITNOW_CONFIG_FILE; or set -g GITNOW_CONFIG_FILE ~/.gitnow
8+
set -g gitnow_commands 'all' 'assume' 'bitbucket' 'bugfix' 'commit' 'commit-all' 'feature' 'github' 'gitnow' 'hotfix' 'logs' 'merge' 'move' 'pull' 'push' 'release' 'show' 'stage' 'state' 'tag' 'unstage' 'untracked' 'upstream'
9+
10+
if set -q __fish_config_dir
11+
set -g fish_config "$__fish_config_dir"
12+
else
13+
set -q XDG_CONFIG_HOME
14+
and set -g fish_config "$XDG_CONFIG_HOME/fish"
15+
or set -g fish_config "~/.config/fish"
16+
end
17+
18+
set -q fish_snippets; or set -g fish_snippets "$fish_config/conf.d"
19+
20+
__gitnow_load_config
21+
22+
# Other specific global variables
523
set -g g_current_branch
624

725
function __gitnow_install -e gitnow_install

conf.d/gitnow_config.fish

Lines changed: 0 additions & 32 deletions
This file was deleted.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# GitNow — Speed up your Git workflow. 🐠
2+
# https://github.com/joseluisq/gitnow
3+
4+
function __gitnow_check_if_branch_exist
5+
set -l xfound 0
6+
7+
if test (count $argv) -eq 1
8+
set -l xbranch $argv[1]
9+
set -l xbranch_list (__gitnow_current_branch_list)
10+
11+
for b in $xbranch_list
12+
if [ "$xbranch" = "$b" ]
13+
set xfound 1
14+
break
15+
end
16+
end
17+
end
18+
19+
echo $xfound
20+
end

functions/__gitnow_clone_msg.fish

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# GitNow — Speed up your Git workflow. 🐠
2+
# https://github.com/joseluisq/gitnow
3+
4+
function __gitnow_clone_msg
5+
set -l msg $argv[1]
6+
7+
echo "Repository name is required!"
8+
echo "Example: $msg your-repo-name"
9+
echo "Usages:"
10+
echo " a) $msg username/repo-name"
11+
echo " b) $msg username repo-name"
12+
echo " c) $msg repo-name"
13+
echo " For this, it's necessary to set your $msg username (login)"
14+
echo " to global config before like: "
15+
echo " git config --global user.$msg \"your-username\""
16+
echo
17+
end

0 commit comments

Comments
 (0)