Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#176 : Correction of zsh completion #177

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Turiok
Copy link

@Turiok Turiok commented Nov 1, 2023

I'm new to completion.
I read this https://github.com/zsh-users/zsh-completions/blob/master/zsh-completions-howto.org to understand ZSH completion.

It seems to work now :

transcrypt -<TAB>                                                                                                                                                                                                                    
 -- option --
--cipher             -c  -- specify encryption cipher                                                                                                                                                                                       
--display            -d  -- display current credentials                                                                                                                                                                                     
--export-gpg         -e  -- export config to gpg recipient                                                                                                                                                                                  
--flush-credentials  -f  -- flush cached credentials                                                                                                                                                                                        
--force              -F  -- ignore repository clean state                                                                                                                                                                                   
--help               -h  -- view help message                                                                                                                                                                                               
--import-gpg         -i  -- import config from gpg file                                                                                                                                                                                     
--list               -l  -- list encrypted files                                                                                                                                                                                            
--password           -p  -- specify encryption password                                                                                                                                                                                     
--rekey              -r  -- rekey all encrypted files                                                                                                                                                                                       
--set-openssl-path       -- use OpenSSL at this path                                                                                                                                                                                        
--show-raw           -s  -- show raw file                                                                                                                                                                                                   
--uninstall          -u  -- uninstall transcrypt                                                                                                                                                                                            
--upgrade                -- upgrade transcrypt                                                                                                                                                                                              
--version            -v  -- print version                                                                                                                                                                                                   
--yes                -y  -- assume yes and accept defaults

and with the option "--set-openssl-path" it display folder tree for the path.
I'm just not sure why when this option is used, the other can't be?
the other options :

-c --cipher -d --display -f --flush-credentials -p --password -r --rekey

Try to correct #176

@Turiok Turiok changed the title #17 : Correction of zsh completion #176 : Correction of zsh completion Nov 1, 2023
@Turiok
Copy link
Author

Turiok commented Nov 1, 2023

I added another correction for listing cipher.
open ssl version :

$>openssl version                                                                                                                                                                                                                         
OpenSSL 3.0.9 30 May 2023 (Library: OpenSSL 3.0.9 30 May 2023)

The result :

$>transcrypt --cipher=<TAB>                                                                                                                                                                                                                    
 -- available ciphers --
aes-128-cbc       aes-128-ecb       aes-192-cbc       aes-192-ecb         aria-192-cfb8     aria-192-ctr      aria-192-ecb      aria-192-ofb        camellia-256-ecb  des-ede           des-ede-cbc       des-ede-cfb       
aes-256-cbc       aes-256-ecb       aria-128-cbc      aria-128-cfb        aria-256-cbc      aria-256-cfb      aria-256-cfb1     aria-256-cfb8       des-ede3-ofb      des3              sm4-cbc           sm4-cfb           
aria-128-cfb1     aria-128-cfb8     aria-128-ctr      aria-128-ecb        aria-256-ctr      aria-256-ecb      aria-256-ofb      camellia-128-cbc    des-ede-ofb       des-ede3          des-ede3-cbc      des-ede3-cfb      
aria-128-ofb      aria-192-cbc      aria-192-cfb      aria-192-cfb1       camellia-128-ecb  camellia-192-cbc  camellia-192-ecb  camellia-256-cbc    sm4-ctr           sm4-ecb           sm4-ofb

@jmurty
Copy link
Collaborator

jmurty commented Nov 27, 2023

Hi @Turiok thanks for working to improve the zsh completions, this looks like it could be great.

However I haven't been able to get it to work to test it myself before I merge your improvements. Can you describe how you installed/activated the improved completions to test them?

I have tried these commands from the documentation you linked, but when I try different completions in my zsh I only get a local file list, or nothing.

This is what I have tried, on macOS 14.1.1:

zsh --version
# zsh 5.9 (arm-apple-darwin21.3.0)

openssl version
# OpenSSL 3.1.4 24 Oct 2023 (Library: OpenSSL 3.1.4 24 Oct 2023)

# Try to add repository completions file to 'fpath' to load completions
fpath=(~/x/y/z/transcrypt/contrib/zsh $fpath)

# Try to trigger reload/activation of completions in repository
unfunction _transcrypt
autoload -U _transcrypt

After what I assume is a successful load of the repository's completions (no errors from autoload -U):

transcrypt --cipher=<TAB>
# Nothing

transcrypt --<TAB>
# Nothing

transcrypt <TAB>
# Select from files in current working directory

@Turiok
Copy link
Author

Turiok commented Nov 29, 2023

Hi @jmurty

In my computer, I use zinit to handle my zsh https://github.com/zdharma-continuum/zinit.

I tried with a clean zsh and your solution and it didn't work :

$> zsh --version
zsh 5.9 (x86_64-pc-linux-gnu)

$> zsh -s -f -i
# To have a clean zsh

$> transcrypt -<TAB><TAB>
# Display nothing

$> fpath=$HOME/.zinit/plugins/elasticdog---transcrypt/contrib/zsh
# Display nothing

$>  unfunction _transcrypt
unfunction: no such hash table element: _transcrypt

$> autoload -U _transcrypt
# Display nothing

$> transcrypt -<TAB><TAB>
# Display nothing

Finally I search another solution without zinit and it works if you can try? :

 $> zsh -s -f -i
# To have a clean zsh

$> fpath=(~/.zinit/plugins/elasticdog---transcrypt/contrib/zsh $fpath)

$> autoload -U compinit; compinit

$> transcrypt -<TAB><TAB>
--cipher             -c  -- specify encryption cipher                                                                                                                                                                                       
--display            -d  -- display current credentials                                                                                                                                                                                     
--export-gpg         -e  -- export config to gpg recipient                                                                                                                                                                                  
--flush-credentials  -f  -- flush cached credentials                                                                                                                                                                                        
--force              -F  -- ignore repository clean state                                                                                                                                                                                   
--help               -h  -- view help message                                                                                                                                                                                               
--import-gpg         -i  -- import config from gpg file                                                                                                                                                                                     
--list               -l  -- list encrypted files                                                                                                                                                                                            
--password           -p  -- specify encryption password                                                                                                                                                                                     
--rekey              -r  -- rekey all encrypted files                                                                                                                                                                                       
--set-openssl-path       -- use OpenSSL at this path                                                                                                                                                                                        
--show-raw           -s  -- show raw file                                                                                                                                                                                                   
--uninstall          -u  -- uninstall transcrypt                                                                                                                                                                                            
--upgrade                -- upgrade transcrypt                                                                                                                                                                                              
--version            -v  -- print version                                                                                                                                                                                                   
--yes                -y  -- assume yes and accept defaults

$> transcrypt --cipher=<TAB><TAB>
aes-128-cbc       aes-128-ecb       aes-192-cbc       aes-192-ecb         aria-192-cfb8     aria-192-ctr      aria-192-ecb      aria-192-ofb        camellia-256-ecb  des-ede           des-ede-cbc       des-ede-cfb       
aes-256-cbc       aes-256-ecb       aria-128-cbc      aria-128-cfb        aria-256-cbc      aria-256-cfb      aria-256-cfb1     aria-256-cfb8       des-ede3-ofb      des3              sm4-cbc           sm4-cfb           
aria-128-cfb1     aria-128-cfb8     aria-128-ctr      aria-128-ecb        aria-256-ctr      aria-256-ecb      aria-256-ofb      camellia-128-cbc    des-ede-ofb       des-ede3          des-ede3-cbc      des-ede3-cfb      
aria-128-ofb      aria-192-cbc      aria-192-cfb      aria-192-cfb1       camellia-128-ecb  camellia-192-cbc  camellia-192-ecb  camellia-256-cbc    sm4-ctr           sm4-ecb           sm4-ofb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants