LINT_LOCS_PY ?= $(shell git ls-files '*.py')
LINT_LOCS_SH ?= $(shell git ls-files '*.sh' ':!tests/system-test.sh')
-FORMAT_LOCS_SH ?= completions/**
+FORMAT_LOCS_SHELL ?= completions/*.sh completions/**/*
.PHONY: format
format: ##H Format scripts
@$(call print_target,format)
@$(call print_info,Formatting shell scripts...)
- shfmt -ci -bn -s -w $(LINT_LOCS_SH) $(FORMAT_LOCS_SH)
+ shfmt -ci -bn -s -w $(LINT_LOCS_SH) $(FORMAT_LOCS_SHELL)
@$(call print_success,OK.)
@$(call print_info,Formatting Python scripts...)
-black $(LINT_LOCS_PY)
# 1. First argument: complete commands and global options
if [[ $COMP_CWORD -eq 1 ]]; then
COMPREPLY=($(compgen -W "$commands $opts" -- "$cur"))
- if [[ "$cur" == gcrypt::* ]]; then
+ if [[ $cur == gcrypt::* ]]; then
COMPREPLY+=("$cur")
fi
return 0
# 2. Handle subcommands
case "${COMP_WORDS[1]}" in
- clean)
- local remotes=$(git remote -v 2>/dev/null | grep 'gcrypt::' | awk '{print $1}' | sort -u || :)
- COMPREPLY=($(compgen -W "--force --init --hard $remotes" -- "$cur"))
- return 0
- ;;
- check | stat)
- local remotes=$(git remote 2>/dev/null || :)
- COMPREPLY=($(compgen -W "$remotes" -- "$cur"))
- return 0
- ;;
- capabilities | fetch | list | push)
- COMPREPLY=($(compgen -W "-h --help" -- "$cur"))
- return 0
- ;;
+ clean)
+ local remotes=$(git remote -v 2>/dev/null | grep 'gcrypt::' | awk '{print $1}' | sort -u || :)
+ COMPREPLY=($(compgen -W "--force --init --hard $remotes" -- "$cur"))
+ return 0
+ ;;
+ check | stat)
+ local remotes=$(git remote 2>/dev/null || :)
+ COMPREPLY=($(compgen -W "$remotes" -- "$cur"))
+ return 0
+ ;;
+ capabilities | fetch | list | push)
+ COMPREPLY=($(compgen -W "-h --help" -- "$cur"))
+ return 0
+ ;;
esac
# 3. Fallback (global flags if not in a known subcommand?)
- if [[ "$cur" == -* ]]; then
+ if [[ $cur == -* ]]; then
COMPREPLY=($(compgen -W "$opts" -- "$cur"))
return 0
fi
complete -c git-remote-gcrypt -n "__fish_seen_subcommand_from stat" -a "(git remote 2>/dev/null)" -d 'Git Remote'
# Clean flags
-complete -c git-remote-gcrypt -f -n "__fish_seen_subcommand_from clean" -l force -d 'Flag';
-complete -c git-remote-gcrypt -f -n "__fish_seen_subcommand_from clean" -l init -d 'Flag';
-complete -c git-remote-gcrypt -f -n "__fish_seen_subcommand_from clean" -l hard -d 'Flag';
+complete -c git-remote-gcrypt -f -n "__fish_seen_subcommand_from clean" -l force -d 'Flag'
+complete -c git-remote-gcrypt -f -n "__fish_seen_subcommand_from clean" -l init -d 'Flag'
+complete -c git-remote-gcrypt -f -n "__fish_seen_subcommand_from clean" -l hard -d 'Flag'
# 1. First argument: complete commands and global options
if [[ $COMP_CWORD -eq 1 ]]; then
COMPREPLY=($(compgen -W "$commands $opts" -- "$cur"))
- if [[ "$cur" == gcrypt::* ]]; then
+ if [[ $cur == gcrypt::* ]]; then
COMPREPLY+=("$cur")
fi
return 0
# 2. Handle subcommands
case "${COMP_WORDS[1]}" in
- clean)
- local remotes=$(git remote -v 2>/dev/null | grep 'gcrypt::' | awk '{print $1}' | sort -u || :)
- COMPREPLY=($(compgen -W "{clean_flags_bash} $remotes" -- "$cur"))
- return 0
- ;;
- check | stat)
- local remotes=$(git remote 2>/dev/null || :)
- COMPREPLY=($(compgen -W "$remotes" -- "$cur"))
- return 0
- ;;
- capabilities | fetch | list | push)
- COMPREPLY=($(compgen -W "-h --help" -- "$cur"))
- return 0
- ;;
+ clean)
+ local remotes=$(git remote -v 2>/dev/null | grep 'gcrypt::' | awk '{print $1}' | sort -u || :)
+ COMPREPLY=($(compgen -W "{clean_flags_bash} $remotes" -- "$cur"))
+ return 0
+ ;;
+ check | stat)
+ local remotes=$(git remote 2>/dev/null || :)
+ COMPREPLY=($(compgen -W "$remotes" -- "$cur"))
+ return 0
+ ;;
+ capabilities | fetch | list | push)
+ COMPREPLY=($(compgen -W "-h --help" -- "$cur"))
+ return 0
+ ;;
esac
# 3. Fallback (global flags if not in a known subcommand?)
- if [[ "$cur" == -* ]]; then
+ if [[ $cur == -* ]]; then
COMPREPLY=($(compgen -W "$opts" -- "$cur"))
return 0
fi
_arguments -s -S $args
case $line[1] in
- clean)
- _arguments {clean_flags_zsh} \
- '*:gcrypt URL: _alternative "remotes:gcrypt remote:($(git remote -v 2>/dev/null | grep "gcrypt::" | awk "{print \$1}" | sort -u))" "files:file:_files"'
- ;;
- check | stat)
- _arguments \
- '*:gcrypt URL: _alternative "remotes:git remote:($(git remote 2>/dev/null))" "files:file:_files"'
- ;;
- *)
- _arguments \
- '*:gcrypt URL:'
- ;;
+ clean)
+ _arguments {clean_flags_zsh} \
+ '*:gcrypt URL: _alternative "remotes:gcrypt remote:($(git remote -v 2>/dev/null | grep "gcrypt::" | awk "{print \$1}" | sort -u))" "files:file:_files"'
+ ;;
+ check | stat)
+ _arguments \
+ '*:gcrypt URL: _alternative "remotes:git remote:($(git remote 2>/dev/null))" "files:file:_files"'
+ ;;
+ *)
+ _arguments \
+ '*:gcrypt URL:'
+ ;;
esac
}
_arguments -s -S $args
case $line[1] in
- clean)
- _arguments --force'[Flag]' --init'[Flag]' --hard'[Flag]' \
- '*:gcrypt URL: _alternative "remotes:gcrypt remote:($(git remote -v 2>/dev/null | grep "gcrypt::" | awk "{print \$1}" | sort -u))" "files:file:_files"'
- ;;
- check | stat)
- _arguments \
- '*:gcrypt URL: _alternative "remotes:git remote:($(git remote 2>/dev/null))" "files:file:_files"'
- ;;
- *)
- _arguments \
- '*:gcrypt URL:'
- ;;
+ clean)
+ _arguments --force'[Flag]' --init'[Flag]' --hard'[Flag]' \
+ '*:gcrypt URL: _alternative "remotes:gcrypt remote:($(git remote -v 2>/dev/null | grep "gcrypt::" | awk "{print \$1}" | sort -u))" "files:file:_files"'
+ ;;
+ check | stat)
+ _arguments \
+ '*:gcrypt URL: _alternative "remotes:git remote:($(git remote 2>/dev/null))" "files:file:_files"'
+ ;;
+ *)
+ _arguments \
+ '*:gcrypt URL:'
+ ;;
esac
}