YunoHost / issues

General issue tracker for the YunoHost project
72 stars 8 forks source link

Auto-completion for Fish Shell #2309

Open silverhook opened 10 months ago

silverhook commented 10 months ago

It would be great if the yunohost CLI command would have auto-completion for Fish shell.

Useful resources: https://fishshell.com/docs/current/completions.html

I volunteer to take a stab at it. But this could take a long time as I have neither written an auto-completion script nor contributed to YunoHost before. So if you see this issue and think you can fix it and haven’t seen a fix from me here yet, you are more than welcome to contribute tho solution.

silverhook commented 10 months ago

The one generated from the man page is a good start, but needs some structure applied to it:

# yunohost
# Autogenerated from man page /usr/share/man/man8/yunohost.8.gz
complete -c yunohost -s h -l help --description 'show this help message and exit  .'
complete -c yunohost -l no-cache --description 'Don\'t use actions map cache.'
complete -c yunohost -l output-as --description 'Output result in another format.'
complete -c yunohost -l debug --description 'Log and print debug messages.'
complete -c yunohost -l quiet --description 'Don\'t produce any output.'
complete -c yunohost -l timeout --description 'Number of seconds before this command will timeout because it can\'t acquire t…'
complete -c yunohost -l admin-password --description 'The admin password to use to authenticate.'
complete -c yunohost -s v -l version --description 'Display YunoHost packages versions YUNOHOST USER usage: yunohost user {list,c…'
complete -c yunohost -l fields --description ' ,fields  fields to fetch (username, fullname, mail, mail-alias, mail-forward…'
complete -c yunohost -s F -l fullname --description ' ,fullname  The full name of the user.  For example \'Camille Dupont\'.'
complete -c yunohost -s f -l firstname --description ' ,firstname  Deprecated.  Use --fullname instead.'
complete -c yunohost -s l -l lastname --description ' ,lastname  Deprecated.  Use --fullname instead.'
complete -c yunohost -s p -l password --description ' ,password  User password.'
complete -c yunohost -s d -l domain --description ' ,domain  Domain for the email address and xmpp account.'
complete -c yunohost -s q -l mailbox-quota --description ' ,mailbox-quota (default: 0) Mailbox size quota.'
complete -c yunohost -s s -l loginShell --description ' ,loginShell (default: /bin/bash) The login shell used yunohost user delete  …'
complete -c yunohost -l purge --description '.'
complete -c yunohost -s m -l mail --description ' ,mail .'
complete -c yunohost -l change-password --description ' ,change-password  New password to set.'
complete -c yunohost -l add-mailforward --description ' ,add-mailforward  Mailforward addresses to add.'
complete -c yunohost -l remove-mailforward --description ' ,remove-mailforward  Mailforward addresses to remove.'
complete -c yunohost -l add-mailalias --description ' ,add-mailalias  Mail aliases to add.'
complete -c yunohost -l remove-mailalias --description ' ,remove-mailalias  Mail aliases to remove.'
complete -c yunohost -s u -l update --description '.'
complete -c yunohost -l delete --description '.'
complete -c yunohost -l short --description '.'
complete -c yunohost -l full --description '.'
complete -c yunohost -l include-primary-groups --description '.'
complete -c yunohost -l label --description ' ,label  Label for this permission.'
complete -c yunohost -l show_tile --description ' ,show_tile  Define if a tile will be shown in the SSO yunohost user permissi…'
complete -c yunohost -s c -l comment --description ' ,comment  Optional comment about the key yunohost user ssh remove-key  ,user…'
complete -c yunohost -l exclude-subdomains --description '.'
complete -c yunohost -l tree --description '.'
complete -c yunohost -l features --description ' ,features  List only domains with features enabled (xmpp, mail_in, mail_out)…'
complete -c yunohost -l ignore-dyndns --description '.'
complete -c yunohost -l dyndns-recovery-password --description ' ,dyndns-recovery-password  If adding a DynDNS domain, subscribe to the DynDN…'
complete -c yunohost -s r -l remove-apps --description '.'
complete -c yunohost -l force --description '.'
complete -c yunohost -s n -l new-main-domain --description ' ,new-main-domain  Change the current main domain yunohost domain cert-status…'
complete -c yunohost -l no-checks --description '.'
complete -c yunohost -l self-signed --description '.'
complete -c yunohost -l email --description '.'
complete -c yunohost -s a -l args --description ' ,args  Serialized arguments for action (i. e.'
complete -c yunohost -l recovery-password --description ' ,recovery-password  Password used to later recover the domain if needed yuno…'
complete -c yunohost -s e -l export --description '.'
complete -c yunohost -l value --description ' ,value  new value.'
complete -c yunohost -l dry-run --description '.'
complete -c yunohost -l with-categories --description '.'
complete -c yunohost -l with-antifeatures --description '.'
complete -c yunohost -l with-screenshot --description '.'
complete -c yunohost -l upgradable --description '.'
complete -c yunohost -l app --description ' ,app  Specific app to map.'
complete -c yunohost -l raw --description '.'
complete -c yunohost -l user --description ' ,user  Allowed app map for a user yunohost app install  ,app/.'
complete -c yunohost -l no-remove-on-failure --description '.'
complete -c yunohost -l url --description ' ,url  Git url to fetch for upgrade.'
complete -c yunohost -l file --description ' ,file  Folder or tarball for upgrade.'
complete -c yunohost -s b -l no-safety-backup --description '.'
complete -c yunohost -l continue-on-failure --description '.'
complete -c yunohost -l path --description ' ,path  New path at which the application will be moved yunohost app setting …'
complete -c yunohost -l undo --description '.'
complete -c yunohost -l args-file --description ' ,args-file  YAML or JSON file with key/value couples YUNOHOST BACKUP usage: …'
complete -c yunohost -l name --description ' ,name  Name of the backup archive.'
complete -c yunohost -l description --description ' ,description  Short description of the backup.'
complete -c yunohost -s o -l output-directory --description ' ,output-directory  Output directory for the backup.'
complete -c yunohost -l methods --description ' ,methods  List of backup methods to apply (copy or tar by default).'
complete -c yunohost -l system --description ' ,system  List of system parts to backup (or all if none given).'
complete -c yunohost -l apps --description ' ,apps  List of application names to backup (or all if none given).'
complete -c yunohost -s i -l with-info --description '.'
complete -c yunohost -s H -l human-readable --description '.'
complete -c yunohost -l with-details --description '.'
complete -c yunohost -l log --description ' ,log  Absolute path to log file to display.'
complete -c yunohost -l test_status --description ' ,test_status  Specify a custom bash command to check the status of the servi…'
complete -c yunohost -l test_conf --description ' ,test_conf  Specify a custom bash command to check if the configuration of t…'
complete -c yunohost -l needs_exposed_ports --description ' ,needs_exposed_ports  A list of ports that needs to be publicly exposed for …'
complete -c yunohost -l need_lock --description '.'
complete -c yunohost -l number --description ' ,number (default: 50) Number of lines to display YUNOHOST FIREWALL usage: yu…'
complete -c yunohost -l by-ip-version --description '.'
complete -c yunohost -l list-forwarded --description '.'
complete -c yunohost -s 4 -l ipv4-only --description '.'
complete -c yunohost -s 6 -l ipv6-only --description '.'
complete -c yunohost -l no-upnp --description '.'
complete -c yunohost -l no-reload --description '.'
complete -c yunohost -l upnp-only --description '.'
complete -c yunohost -l no-refresh --description '.'
complete -c yunohost -l skip-upnp --description '.'
complete -c yunohost -s D --description '.'
complete -c yunohost -l new-password --description ' ,new-password  yunohost tools maindomain  [ ,-n/|,--new-main-domain  new-mai…'
complete -c yunohost -l username --description ' ,username  Username for the first (admin) user.  For example \'camille\'.'
complete -c yunohost -l force-diskspace --description '.'
complete -c yunohost -l command --description ' ,command  python command to execute yunohost tools shutdown  [ ,-f/|,--force.'
complete -c yunohost -l with-diff --description '.'
complete -c yunohost -l list-pending --description '.'
complete -c yunohost -l pending --description '.'
complete -c yunohost -l done --description '.'
complete -c yunohost -l skip --description '.'
complete -c yunohost -l force-rerun --description '.'
complete -c yunohost -l auto --description '.'
complete -c yunohost -l accept-disclaimer --description '.'
complete -c yunohost -l list-by --description ' ,list-by (default: name) Property to list hook by.'
complete -c yunohost -l show-info --description '.'
complete -c yunohost -l hooks --description ' ,hooks  List of hooks names to execute.'
complete -c yunohost -l no-trace --description '.'
complete -c yunohost -l chdir --description ' ,chdir  The directory from where the scripts will be executed yunohost hook …'
complete -c yunohost -l raise-on-error --description '.'
complete -c yunohost -l limit --description ' ,limit (default: 50) Maximum number of operations to list (default to 50).'
complete -c yunohost -l with-suboperations --description '.'
complete -c yunohost -l share --description '.'
complete -c yunohost -l filter-irrelevant --description '.'
complete -c yunohost -l issues --description '.'
complete -c yunohost -l except-if-never-ran-yet --description '.'
complete -c yunohost -l filter --description ' ,filter  Add a filter.'
complete -c yunohost -l list --description '.'
silverhook commented 10 months ago

Somewhat related to https://github.com/YunoHost/yunohost/pull/1712/