]> Nutra Git (v1) - gamesguru/git-remote-gcrypt.git/commitdiff
update completions
authorShane Jaroch <chown_tee@proton.me>
Thu, 8 Jan 2026 20:55:08 +0000 (15:55 -0500)
committerShane Jaroch <chown_tee@proton.me>
Thu, 8 Jan 2026 20:55:08 +0000 (15:55 -0500)
README.rst
completions/README.rst
completions/bash/git-remote-gcrypt
completions/fish/git-remote-gcrypt.fish
completions/zsh/_git-remote-gcrypt
git-remote-gcrypt
tests/test-clean-command.sh

index 2a566ee76f0a5c7c96e62edba4f129720071e6ee..dc3900ac7967d09ebfe47e9debe34dd96afd291e 100644 (file)
@@ -256,7 +256,12 @@ Each item extends until newline, and matches one of the following:
 Detecting gcrypt repos
 ======================
 
-To detect if a git url is a gcrypt repo, use: ``git-remote-gcrypt --check url``
+To detect if a git url is a gcrypt repo, use::
+
+    git-remote-gcrypt check url
+
+(Legacy syntax ``--check`` is also supported).
+
 Exit status is 0 if the repo exists and can be decrypted, 1 if the repo
 uses gcrypt but could not be decrypted, and 100 if the repo is not
 encrypted with gcrypt (or could not be accessed).
@@ -264,6 +269,21 @@ encrypted with gcrypt (or could not be accessed).
 Note that this has to fetch the repo contents into the local git
 repository, the same as is done when using a gcrypt repo.
 
+Cleaning gcrypt repos
+=====================
+
+To scan for unencrypted files in a remote gcrypt repo, use::
+
+    git-remote-gcrypt clean [url|remote]
+
+If no URL or remote is specified, ``git-remote-gcrypt`` will list all
+available ``gcrypt::`` remotes.
+
+By default, this command only performs a scan. To actually remove the
+unencrypted files, you must use the ``--force`` (or ``-f``) flag::
+
+    git-remote-gcrypt clean url --force
+
 Known issues
 ============
 
index d1e6f5580e378663ab4851159990ae7484b185ac..0c8b3659a77b71937f29f848d9fa9f6826923606 100644 (file)
@@ -45,7 +45,10 @@ Supported Completions
 
 - ``-h``, ``--help`` - Show help message
 - ``-v``, ``--version`` - Show version information
-- ``--check`` - Check if URL is a gcrypt repository
+- ``check`` - Check if URL is a gcrypt repository
+- ``clean`` - Scan/Clean unencrypted files from remote
+  - ``-f``, ``--force`` - Actually delete files during clean
+- ``--check`` - (Legacy) Check if URL is a gcrypt repository
 
 Notes
 =====
index 18da214b27c65a8b241b4a43d14a1addda18024d..b4013110004c17944561c87eb5454c982a2c129d 100644 (file)
@@ -7,7 +7,7 @@ _git_remote_gcrypt() {
        cur="${COMP_WORDS[COMP_CWORD]}"
        prev="${COMP_WORDS[COMP_CWORD - 1]}"
        opts="-h --help -v --version --check"
-       commands="capabilities list push fetch"
+       commands="capabilities list push fetch check clean"
 
        # If we're after a subcommand, only offer -h/--help
        if [[ " $commands " =~ " ${COMP_WORDS[1]:-} " ]]; then
@@ -16,7 +16,11 @@ _git_remote_gcrypt() {
        fi
 
        case "$prev" in
-       --check)
+       clean)
+               COMPREPLY=($(compgen -W "-f --force" -- "$cur"))
+               return 0
+               ;;
+       --check | check)
                # Complete with gcrypt:: URLs or file paths
                COMPREPLY=($(compgen -f -- "$cur"))
                return 0
index 9d089ce62235e82ff8f804a06827bc0082bdf9a5..2560ccb35cf81446158150c87a842ee9d0dc8c45 100644 (file)
@@ -3,10 +3,17 @@
 
 complete -c git-remote-gcrypt -s h -l help -d 'Show help message'
 complete -c git-remote-gcrypt -s v -l version -d 'Show version information'
-complete -c git-remote-gcrypt -l check -d 'Check if URL is a gcrypt repository' -r -F
+complete -c git-remote-gcrypt -l check -d '(Legacy) Check if URL is a gcrypt repository' -r -F
+
+# Subcommands
+complete -c git-remote-gcrypt -f -n "not __fish_seen_subcommand_from capabilities list push fetch check clean" -a 'check' -d 'Check if URL is a gcrypt repository'
+complete -c git-remote-gcrypt -f -n "not __fish_seen_subcommand_from capabilities list push fetch check clean" -a 'clean' -d 'Scan/Clean unencrypted files from remote'
+
+# Clean flags
+complete -c git-remote-gcrypt -f -n "__fish_seen_subcommand_from clean" -s f -l force -d 'Actually delete files during clean'
 
 # Git protocol commands
-complete -c git-remote-gcrypt -f -a 'capabilities' -d 'Show git remote helper capabilities'
-complete -c git-remote-gcrypt -f -a 'list' -d 'List refs in remote repository'
-complete -c git-remote-gcrypt -f -a 'push' -d 'Push refs to remote repository'
-complete -c git-remote-gcrypt -f -a 'fetch' -d 'Fetch refs from remote repository'
+complete -c git-remote-gcrypt -f -n "not __fish_seen_subcommand_from capabilities list push fetch check clean" -a 'capabilities' -d 'Show git remote helper capabilities'
+complete -c git-remote-gcrypt -f -n "not __fish_seen_subcommand_from capabilities list push fetch check clean" -a 'list' -d 'List refs in remote repository'
+complete -c git-remote-gcrypt -f -n "not __fish_seen_subcommand_from capabilities list push fetch check clean" -a 'push' -d 'Push refs to remote repository'
+complete -c git-remote-gcrypt -f -n "not __fish_seen_subcommand_from capabilities list push fetch check clean" -a 'fetch' -d 'Fetch refs from remote repository'
index f3686d573b93ac84c7117978b2d3b0caff8036c8..86c5d83ee4d483ce350d98f33e0cfa6d9061f1c3 100644 (file)
@@ -8,10 +8,26 @@ _git_remote_gcrypt() {
                '(- *)'{-h,--help}'[show help message]'
                '(- *)'{-v,--version}'[show version information]'
                '--check[check if URL is a gcrypt repository]:URL:_files'
-               '1:command:(capabilities list push fetch)'
-               '*:gcrypt URL:'
+               '1:command:(capabilities list push fetch check clean)'
+               '*::subcommand arguments:->args'
        )
        _arguments -s -S $args
+
+       case $words[1] in
+       clean)
+               _arguments \
+                       '(-f --force)'{-f,--force}'[actually delete files]' \
+                       '*:gcrypt URL:'
+               ;;
+       check)
+               _arguments \
+                       '1:gcrypt URL:_files'
+               ;;
+       *)
+               _arguments \
+                       '*:gcrypt URL:'
+               ;;
+       esac
 }
 
 _git_remote_gcrypt "$@"
index 864ea6f92154b959b5354665756ca80815062f0c..6e8767f51fb9633f848c1a86eae57dfef4ce07d8 100755 (executable)
@@ -776,7 +776,7 @@ ensure_connected()
                                                echo_info "Found the following unexpected files:"
                                                echo_info "$early_bad_files" | head -n 5 | sed 's/^/  /' >&2
                                                echo_info ""
-                                               echo_info "To fix: use 'git-remote-gcrypt --clean $URL' to remove these files,"
+                                               echo_info "To fix: use 'git-remote-gcrypt clean --force $URL' to remove these files,"
                                                echo_info "or set 'git config gcrypt.allow-unencrypted-remote true' to ignore."
                                                exit 1
                                        fi
index 4a105168bdfd5b5fef30d0d7b541b0df0319c216..f39d51187040475f5d56697ea343b9ca10be29a8 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/bash
-# Test: --clean command removes unencrypted files
-# This test verifies that git-remote-gcrypt --clean correctly identifies
+# Test: clean command removes unencrypted files
+# This test verifies that git-remote-gcrypt clean correctly identifies
 # and removes unencrypted files from a remote.
 
 set -e