Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
2493 connectés 

  FORUM HardWare.fr
  Linux et OS Alternatifs
  Codes et scripts

  [ZSH] Yunohost, avis sur un plugin de completion

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

[ZSH] Yunohost, avis sur un plugin de completion

n°1430008
fol_de_dol
Posté le 16-02-2019 à 11:41:03  profilanswer
 

Hello les gens,
 
Je découvre ce forum, et je me suis dit que je pouvais éventuellement demander aux gens ici un avis sur un sujet un point technique  :ange:  
 
En bref (dans le titre :3 ), je suis en train d'écrire un plugin d'autocomplétion ZSH pour YunoHost[1].
Je me demandais si certains d'entre vous aviez un peu d'expérience sur ce sujet.
 
J'en ai écrit une partie, pas tout, et je voulais avoir un avis sur la direction que je prenais, si je n'étais pas en train de faire un truc dégeu :)
 
J'ai déjà posé un topic sur le forum de YunoHost[2], mais je n'ai pas trouvé de personne qui s'y connaissait en ZSH dessus.
 
Voilà :) Merci de votre temps, si vous prenez la peine de vous intéresser à ce sujet.
 
Je posterai en dessous pour des questions plus spécifiques. C'est juste un premier post pour prendre un peu la température des gens avec ZSH ici  :)
 
[1] https://yunohost.org/
[2] https://forum.yunohost.org/t/zsh-completion-plugin/7016
 
Le code du machin :
 

Code :
  1. #compdef yunohost
  2. # ------------------------------------------------------------------------------
  3. # Description
  4. # -----------
  5. #
  6. #  Completion script for yunohost
  7. #
  8. # ------------------------------------------------------------------------------
  9. # Authors
  10. # -------
  11. #
  12. #  * Fol <fol -> fol.tf>
  13. #
  14. # ------------------------------------------------------------------------------
  15. local state line curcontext
  16. __log() {
  17.     # For debug purposes only
  18.     echo $@ >> '/root/zsh-completion.log'
  19. }
  20. __jump() {
  21.     local cmd
  22.     #__log -n "__jump :1:$curcontext|$words|$CURRENT|$index"
  23.     # Remember the subcommand name
  24.     if (( ${#@} == 0 )); then
  25.         local cmd=${words[2]}
  26.     else
  27.         cmd=$1 # < no more used?
  28.     fi
  29.     # Set the context for the subcommand
  30.     curcontext="${curcontext}_${cmd}"
  31.     # Narrow the range of words we are looking at to exclude `yunohost`
  32.     (( CURRENT-- ))
  33.     shift words
  34.     #__log ":2: $curcontext|$words"
  35.     # Run the completion for the subcommand
  36.     if ! _call_function ret ${curcontext#:*:}; then
  37.         _default && ret=0
  38.     fi
  39.     return ret
  40. }
  41. _ynh_user_list() {
  42.     local -a list
  43.     list=${(@)$(yunohost user list --fields uid --output-as plain):#\#*}
  44.     compadd "$@" -a list
  45. }
  46. _ynh_domain_list() {
  47.     local -a list
  48.     list=${(@)$(yunohost domain list --output-as plain)}
  49.     compadd "$@" -a list
  50. }
  51. _ynh_app_listlists() {
  52.     local -a list
  53.     list=${(@)${${(f)"$(yunohost app listlists)"}:# *}%:*}
  54.     compadd "$@" -a list
  55. }
  56. # TODO: try to make a function which excludes *installed* apps
  57. _ynh_app_list_id() {
  58.     local -a list
  59.     list=${(@)${(M)${(f)"$(yunohost app list)"}:#*id:*}#*: }
  60.     #list=${(@)${(M)${(f)"$(yunohost app list)"}:#*(id|name):*}#*: }
  61.     compadd "$@" -a list
  62. }
  63. _ynh_app_list_id_installed() {
  64.     local -a list
  65.     list=${(@)${(M)${(f)"$(yunohost app list -i)"}:#*id:*}#*: }
  66.     compadd "$@" -a list
  67. }
  68. _ynh_app_setting_keys() {
  69.     # TODO: parse from /etc/yunohost/apps/{app}/ < give {app} from calling function: $1
  70. }
  71. #(( $+functions[_yunohost] )) ||
  72. _yunohost() {
  73.     #__log '------------------------------------------------------------'
  74.     curcontext='_yunohost'
  75.     typeset -ag help_option; help_option=(
  76.         '(- *)'{-h,--help}'[show this help message and exit]'
  77.     )
  78.     typeset -ag common_options; common_options=(
  79.         "--no-cache[Don't use action map cache]" \
  80.         '--output-as=[Output result in another format]:(json plain none)' \
  81.         '--debug[Log and print debug messages]' \
  82.         "--quiet[Don't produce any output]" \
  83.         "--timeout=[Number of seconds before this command will timeout because it can't aqcuire the lock (meaning that another command is currently running), by default there is no timeout and the command will wait until it can get the lock]:seconds" \
  84.         '--admin-password[The admin password to authenticate]:password' \
  85.         $help_option
  86.     )
  87.     if (( CURRENT > 2 )); then
  88.         __jump
  89.     else
  90.         local -a yunohost_categories; yunohost_categories=(
  91.             'user:Manage users'
  92.             'domain:Manage domains'
  93.             'app:Manage apps'
  94.             'backup:Manage backups'
  95.             'monitor:Monitor the server'
  96.             'settings:Manage YunoHost global settings'
  97.             'service:Manage services'
  98.             'firewall:Manage firewall rules'
  99.             'dyndns:Subscribe and Update DynDNS Hosts'
  100.             'tools:Specific tools'
  101.             'hook:Manage hooks'
  102.             'log:Manage debug logs'
  103.         )
  104.         _describe -V -t yunohost-commands 'yunohost category' yunohost_categories "$@"
  105.     fi
  106.    # TODO: $common_options+=(
  107.    #     '(-v --version)'{-v,--version}'[Display YunoHost packages versions]'
  108.    # )
  109.     _arguments $common_options
  110.     unset common_option
  111. }
  112. # -------- User ----------------------------------------- {{{
  113. # --
  114. #(( $+functions[_yunohost_user] )) || \
  115. _yunohost_user() {
  116.     if (( CURRENT > 2 )); then
  117.         __jump
  118.     else
  119.         local -a yunohost_user; yunohost_user=(
  120.             'list:List users'
  121.             'create:Create user'
  122.             'delete:Delete user'
  123.             'update:Update user informations'
  124.             'info:Get user information'
  125.         )
  126.         local -a yunohost_user_subcategories; yunohost_user_subcategories=(
  127.             'ssh:Manage ssh access'
  128.         )
  129.         _describe -V -t yunohost-user 'yunohost user category' yunohost_user "$@"
  130.         _describe -V -t yunohost-user-subcategories 'yunohost user subcategories' yunohost_user_subcategories "$@"
  131.     fi
  132. }
  133. #(( $+functions[_yunohost_user_list] )) || \
  134. _yunohost_user_list() {
  135.     local i_fields=${words[(ie)--fields]}
  136.     if [[ i_fields -le ${#words} ]]; then # <=> $words.contains('--fields')
  137.         _yunohost_user_list_field
  138.     else
  139.         local -a yunohost_user_list_field; yunohost_user_list_field=(
  140.             '--fields:FIELD1 FIELD2 ...'
  141.         )
  142.         _describe -V -t yunohost-user-list 'yunohost user list FIELDS' yunohost_user_list_field "$@"
  143.     fi
  144.     _arguments $common_options
  145.     # TODO : test _arguments $common_options[@]
  146. }
  147. _yunohost_user_list_field() {
  148.     local -a yunohost_user_list_field_values; yunohost_user_list_field_values=(
  149.         'uid:username' \
  150.         'cn:fullname' \
  151.         'mail:mail' \
  152.         'maildrop:mail-forward' \
  153.         'loginShell:shell' \
  154.         'homeDirectory:home_path' \
  155.         'mailuserquota:mailbox-quota'
  156.     )
  157.     _describe -V -t yunohost-user-list-field 'yunohost user list --fields FIELD [FIELD ...]' yunohost_user_list_field_values "$@"
  158. }
  159. #(( $+functions[_yunohost_user_create] )) || \
  160. _yunohost_user_create() {
  161.     _arguments \
  162.         '1::The unique username to create' \
  163.         '(-f --firstname)'{-f,--firstname}'[Firstname]:firstname:' \
  164.         '(-l --lastname)'{-l,--lastname}'[Lastname]:lastname' \
  165.         '(-m --mail)'{-m,--mail}'[Main unique email address]:email' \
  166.         '(-p --password)'{-p,--password}'[User password]:password' \
  167.         '(-q --mailbox-quota)'{-q,--mailbox-quota}'[Mailbox size quota (SIZE|0)]:quota (SIZE|0)' \
  168.         $common_options
  169. }
  170. _yunohost_user_delete() {
  171.     _arguments \
  172.         '*::Username to delete:_ynh_user_list' \
  173.         '--purge'
  174.         # TODO: $common_options
  175. }
  176. _yunohost_user_update() {
  177.     local last_double_dash=${words[(R)\-\-*]}
  178.     local last_double_dash_index=${words[(I)\-\-*]}
  179.     if [[ "$last_double_dash" =~ '--.*-mail.*' && \
  180.             "$last_double_dash_index" != "${#words}" ]]; then
  181.         local description
  182.         case $last_double_dash in
  183.             --add-mailforward)
  184.                 description='--add-mailforward[Mailforward addresses to add]:MAIL [MAIL ...]';;
  185.             --remove-mailforward)
  186.                 description='--remove-mailforward[Mailforward addresses to remove]:MAIL [MAIL ...]';;
  187.             --add-mailalias)
  188.                 description='--add-mailalias[Mail aliases to add]:MAIL [MAIL ...]';;
  189.             --remove-mailalias)
  190.                 description='--remove-mailalias[Mail aliases to remove]:MAIL [MAIL ...]';;
  191.         esac
  192.         _message -e "yunohost user update $last_double_dash MAIL [MAIL ...]"
  193.     fi
  194.     _arguments \
  195.         '1::Username to update:_ynh_user_list' \
  196.         '(-f --firstname)'{-f,--firstname}'+[Firstname]:firstname:' \
  197.         '(-l --lastname)'{-l,--lastname}'+[Lastname]:lastname' \
  198.         '(-m --mail)'{-m,--mail}'+[Main unique email address]:email' \
  199.         '(-p --change-password)'{-p,--change-password}'+[User password]:password' \
  200.         '--add-mailforward[Mailforward addresses to add]:' \
  201.         '--remove-mailforward[Mailforward addresses to remove]:' \
  202.         '--add-mailalias[Mail aliases to add]:' \
  203.         '--remove-mailalias[Mail aliases to remove]:' \
  204.         '(-q --mailbox-quota)'{-q,--mailbox-quota}'+[Mailbox size quota (SIZE|0)]:quota (SIZE|0):_guard "[0-9]#" "numeric value"'
  205.         #$common_options
  206. }
  207. _yunohost_user_info() {
  208.     _arguments \
  209.         '1::Username or email to get information' \
  210.         $common_options
  211. }
  212. # --- SSH ------------------------------------------------- {{{
  213. _yunohost_user_ssh() {
  214.     if (( CURRENT > 2 )); then
  215.         __jump
  216.     else
  217.         local -a yunohost_user; yunohost_user=(
  218.             'allow:Allow the user to uses ssh' \
  219.             'disallow:Disallow the user to uses ssh' \
  220.             "list-keys:Show user's authorized ssh keys" \
  221.             'add-key:Add a new authorized ssh key for this user' \
  222.             'remove-key:Remove an authorized ssh key for this user'
  223.         )
  224.         _describe -V -t yunohost-user 'yunohost user category' yunohost_user "$@"
  225.     fi
  226. }
  227. _yunohost_user_ssh_allow() {
  228.      _arguments \
  229.         '1::Username of the user' \
  230.         $common_options
  231. }
  232. _yunohost_user_ssh_disallow() {
  233.     _yunohost_user_ssh_allow
  234. }
  235. _yunohost_user_ssh_list-keys() {
  236.     _yunohost_user_ssh_allow
  237. }
  238. _yunohost_user_ssh_add-key() {
  239.      _arguments \
  240.         '1::Username of the user' \
  241.         '2::The key to be added' \
  242.         '(-c --comment)'{-c,--comment}'+[Optionnal comment about the key]:' \
  243.         '(- *)'{-h,--help}'[show this help message and exit]'
  244.         # TODO: add $common_options in a different section
  245. }
  246. _yunohost_user_ssh_remove-key() {
  247.      _arguments \
  248.         '1::Username of the user' \
  249.         '2::The key to be removed' \
  250.         '(-c --comment)'{-c,--comment}'+[Optionnal comment about the key]:' \
  251.         '(- *)'{-h,--help}'[show this help message and exit]'
  252.         # TODO: add $common_options in a different section
  253. }
  254. # }}}
  255. # }}}
  256. # -------- Domain --------------------------------------- {{{
  257. _yunohost_domain() {
  258.     if (( CURRENT > 2 )); then
  259.         __jump
  260.     else
  261.         local -a yunohost_domain; yunohost_domain=(
  262.             'list:List domains'
  263.             'add:Create a custom domain'
  264.             'remove:Delete domains'
  265.             'dns-conf:Generate DNS Configuration for a domain'
  266.             'cert-status:List status of current certificates (all by default).'
  267.             "cert-install:Install Let's Encrypt certificates for given domains (all by default)."
  268.             "cert-renew:Renew the Let's Encrypt certificates for given domains (all by default)."
  269.             'url-available:Check availability of a web path'
  270.         )
  271.         _describe -V -t yunohost-domain 'yunohost domain category' yunohost_domain "$@"
  272.     fi
  273. }
  274. _yunohost_domain_list(){
  275.     _arguments $common_options
  276. }
  277. _yunohost_domain_add(){
  278.     _arguments \
  279.         '1::Domain name to add' \
  280.         '(-d --dyndns)'{-d,--dyndns}'+[Subscribe to the DynDNS service]' \
  281.         '(- *)'{-h,--help}'[show this help message and exit]'
  282.         # TODO: $common_options
  283. }
  284. _yunohost_domain_remove(){
  285.     _arguments \
  286.         '*::Domain to delete:_ynh_domain_list' \
  287.         '(- *)'{-h,--help}'[show this help message and exit]'
  288.         # TODO: $common_options
  289. }
  290. _yunohost_domain_dns-conf(){
  291.     _arguments \
  292.         '1::Target domain' \
  293.         '(-t --ttl)'{-t,--ttl}'+[Time To Live (TTL) in seconds before DNS servers update. Default is 3600 seconds (i.e. 1 hour)]:TTL (seconds|3600):_guard "[0-9]#" "numeric value"' \
  294.         '(- *)'{-h,--help}'[show this help message and exit]'
  295.         # TODO: $common_options
  296. }
  297. _yunohost_domain_cert-status(){
  298.     # TODO: there should be another way do to this, it looks dirty
  299.     local -a args=(
  300.         '--full[Show more details]'
  301.         '(- *)'{-h,--help}'[show this help message and exit]'
  302.     )
  303.     _arguments \
  304.         '1::Domains to check:->domains' \
  305.         $args
  306.     case $state in
  307.     domains)
  308.         _arguments \
  309.             '*::Domains to check:_ynh_domain_list' \
  310.             $args
  311.         ;;
  312.     *)
  313.         _arguments \
  314.             '*:Other domains to check:_ynh_domain_list' \
  315.         ;;
  316.     esac
  317. }
  318. _yunohost_domain_cert-install() {
  319.     local -a args=(
  320.         '--force[Install even if current certificate is not self-signed]'
  321.         '--no-checks[Does not perform any check that your domain seems correctly configured (DNS, reachability) before attempting to install. (Not recommended)]'
  322.         "--self-signed[Install the self-signed certificate instead of Let's Encrypt]"
  323.         "--staging[Use the fake/staging Let's Encrypt certification authority. The new certificate won't actually be enabled - it is only intended to test main steps of the procedure.]"
  324.         '(- *)'{-h,--help}'[show this help message and exit]'
  325.     )
  326.     _arguments \
  327.         '1::Domains for which to install the certificates:->domains' \
  328.         $args
  329.         # TODO: $common_options
  330.     case $state in
  331.     domains)
  332.         _arguments \
  333.             '*::Domains for which to install the certificates:_ynh_domain_list' \
  334.             $args
  335.         ;;
  336.     *)
  337.         _arguments \
  338.             '*:Other domains for which to install the certificates:_ynh_domain_list' \
  339.         ;;
  340.     esac
  341. }
  342. _yunohost_domain_cert-renew(){
  343.     local -a args=(
  344.         '--force[Ignore the validity threshold (30 days)]'
  345.         '--email[Send an email to root with logs id some renewing fails]'
  346.         '--no-checks[Does not perform any check that your domain seems correctly configured (DNS, reachability) before attempting to install. (Not recommended)]'
  347.         "--staging[Use the fake/staging Let's Encrypt certification authority. The new certificate won't actually be enabled - it is only intended to test main steps of the procedure.]"
  348.         '(- *)'{-h,--help}'[show this help message and exit]'
  349.     )
  350.     _arguments \
  351.         '1::Domains for which to renew the certificates:->domains' \
  352.         $args
  353.         # TODO: $common_options
  354.     case $state in
  355.     domains)
  356.         _arguments \
  357.             '1::Domains for which to renew the certificates:_ynh_domain_list' \
  358.             $args
  359.         ;;
  360.     *)
  361.         _arguments \
  362.             '*:Other domains for which to renew the certificates:_ynh_domain_list' \
  363.         ;;
  364.     esac
  365. }
  366. _yunohost_domain_url-available(){
  367.     _arguments \
  368.         '1::The domain for the web path (e.g. your.domain.tld):_ynh_domain_list' \
  369.         '2::The path to check (e.g. /coffee)' \
  370.         '(- *)'{-h,--help}'[show this help message and exit]'
  371.         # TODO: $common_options
  372. }
  373. # }}}
  374. # -------- App ------------------------------------------ {{{
  375. #(( $+functions[_yunohost_app] )) || \
  376. _yunohost_app() {
  377.     if (( CURRENT > 2 )); then
  378.         __jump
  379.     else
  380.         local -a yunohost_app; yunohost_app=(
  381.             'fetchlist:Fetch application lists from app servers, or register a new one.'
  382.             'listlists:List registered application lists'
  383.             'removelist:Remove and forget about a given application list'
  384.             'list:List apps'
  385.             'info:Get information about an installed app'
  386.             'map:List apps by domain'
  387.             'install:Install apps'
  388.             'remove:Remove app'
  389.             'upgrade:Upgrade app'
  390.             "change-url:Change app's URL"
  391.             'setting:Set or get an app setting value'
  392.             'register-url:Book/register a web path for a given app'
  393.             'debug:Display all debug informations for an application'
  394.             'makedefault:Redirect domain root to an app'
  395.             'ssowatconf:Regenerate SSOwat configuration file'
  396.             'change-label:Change app label'
  397.             'addaccess:Grant access right to users (everyone by default)'
  398.             'removeaccess:Revoke access right to users (everyone by default)'
  399.             'clearaccess:Reset access rights for the app'
  400.         )
  401.         local -a yunohost_app_subcategories; yunohost_app_subcategories=(
  402.             'action:Handle apps actions'
  403.             'config:Applications configuration panel'
  404.         )
  405.         _describe -V -t yunohost-app 'yunohost app action' yunohost_app "$@"
  406.         _describe -V -t yunohost-app-subcategories 'yunohost app subcategories' yunohost_app_subcategories "$@"
  407.     fi
  408. }
  409. _yunohost_app_fetchlist() {
  410.     _arguments \
  411.         $help_option \
  412.         '(- *)'{-n,--name}'[Name of the list to fetch (fetches all registered lists if empty)]:NAME:_ynh_app_listlists' \
  413.         '(- *)'{-u,--url}'[URL of a new application list to register. To be specified with -n.]:URL'
  414.         # TODO: $common_options
  415. }
  416. _yunohost_app_listlists() {
  417.     _arguments $help_option
  418. }
  419. _yunohost_app_removelist() {
  420.     _arguments \
  421.         '1::Name of the list to remove:_ynh_app_listlists' \
  422.         $help_option
  423. }
  424. _yunohost_app_list() {
  425.     _arguments \
  426.         $help_option \
  427.       '(-f --filter)'{-f,--filter}'[Name filter of app_id or app_name]:FILTER (only ids are displayed):_ynh_app_list_id' \
  428.       '(-r --raw)'{-r,--raw}'[Return the full app_dict]' \
  429.       '(-i --installed)'{-i,--installed}'[Return only installed apps]' \
  430.       '(-b --with-backup)'{-b,--with-backup}'[Return only apps with backup feature (force --installed filter)]'
  431. }
  432. _yunohost_app_info() {
  433.     _arguments \
  434.         '1::App ID to get information from:_ynh_app_list_id_installed' \
  435.         $help_option \
  436.         '(-s --show-status)'{-s,--show-status}'[Show app installation status]' \
  437.         '(-r --raw)'{-r,--raw}'[Return the full app_dict]'
  438. }
  439. _yunohost_app_map() {
  440.     _arguments \
  441.         $help_option \
  442.         '(-a --app)'{-a,--app}'[Specific app to map]:APP:_ynh_app_list_id_installed' \
  443.         '(-r --raw)'{-r,--raw}'[Return complete dict]' \
  444.         '(-u --user)'{-u,--user}'[Allowed app map for a user]:USER:_ynh_user_list'
  445. }
  446. _yunohost_app_install() {
  447.     _arguments \
  448.         '1::Name, local path or git URL of the app to install:_ynh_app_list_id' \
  449.         $help_option \
  450.         '(-l --label)'{-l,--label}'+[Custom name for the app]' \
  451.         '(-a --args)'{-a,--args}'+[Serialized arguments for app script (i.e. "domain=domain.tld&path=/path" )]' \
  452.         '(-n, --no-remove-on-failure)'{-n,--no-remove-on-failure}'[Debug option to avoid removing the app on a failed installation]' \
  453.         '(-f --force)'{-f,--force}'[Do not ask confirmation if the app is not safe to use (low quality, experimental or 3rd party)]'
  454. }
  455. _yunohost_app_remove() {
  456.     _arguments \
  457.         '*::App(s) to delete:_ynh_app_list_id_installed' \
  458.         $help_option
  459. }
  460. _yunohost_app_upgrade() {
  461.     _arguments \
  462.         $help_option \
  463.         '(-u --url)'{-u,--url}'[Git url to fetch for upgrade]:URL | Git url to fetch for the upgrade' \
  464.         '(-f --file)'{-f,--file}'[Folder or tarball for upgrade]:FILE | Folder or tarball for upgrade:_files' \
  465.         '*:App(s) to upgrade (default all):_ynh_app_list_id_installed'
  466. }
  467. _yunohost_app_change-url() {
  468.     _arguments \
  469.         "1::Target app instance name:_ynh_app_list_id_installed" \
  470.         $help_option \
  471.         '(-d --domain)'{-d,--domain}'[New app domain on which the application will be moved]:New app domain:_ynh_domain_list' \
  472.         '(-p --path)'{-p,--path}'[New path at which the application will be moved]:Path:'
  473. }
  474. _yunohost_app_setting() {
  475.     _arguments \
  476.         '1::App ID:_ynh_app_list_id_installed' \
  477.         '2::Key to get/set:_ynh_app_setting_keys' \
  478.         $help_option \
  479.         '(-v --value)'{-v,--value}'[Value to set]:Value to set' \
  480.         '(-d --delete)'{-d,--delete}'[Delete the key]'
  481. }
  482. _yunohost_app_register-url() {
  483.     _arguments \
  484.         $help_option \
  485.         '1::App which will use the web path:->app' \
  486.         '2::The domain on which the app should be registered (e.g. your.domain.tld):->domain' \
  487.         '3::The path to be registered (e.g. /coffee):->path'
  488. }
  489. _yunohost_app_debug() {
  490.     _arguments \
  491.         '1::App name:->app' \
  492.         $help_option \
  493. }
  494. _yunohost_app_makedefault() {
  495.     _arguments \
  496.         '1::App name to put on domain root:->app' \
  497.         $help_option \
  498.         '(-d --domain)'{-d,--domain}'+[Specific domain to put app on (the app domain by default)]'
  499. }
  500. _yunohost_app_ssowatconf() {
  501.     _arguments $help_option
  502. }
  503. _yunohost_app_change-label() {
  504.     _app_new_label_[-h]
  505.     _arguments \
  506.         '1::App ID:->app' \
  507.         '2::New app label:->label' \
  508.         $help_option
  509. }
  510. _yunohost_app_addaccess() {
  511.     _arguments \
  512.         '*::App ID:->app' \
  513.         $help_option \
  514.         '(-u --users)'{-u,--users}'+[USERS [USERS ...]]'
  515. }
  516. _yunohost_app_removeaccess() {
  517.     _arguments \
  518.         '*::App ID:->app' \
  519.         $help_option \
  520.         '(-u --users)'{-u,--users}'+[USERS [USERS ...]]'
  521. }
  522. _yunohost_app_clearaccess() {
  523.     _arguments \
  524.         '*::App ID:->app' \
  525.         $help_option
  526. }
  527. # ------ App Action -----------------------------------------------
  528. # {{{
  529. _yunohost_app_action() {
  530.     if (( CURRENT > 2 )); then
  531.         __jump
  532.     else
  533.         local -a yunohost_app_action; yunohost_app_action=(
  534.             'list:List app actions'
  535.             'run:Run app actions'
  536.         )
  537.         _describe -V -t yunohost-app-action 'yunohost app action subaction' yunohost_app_action "$@"
  538.     fi
  539. }
  540. _yunohost_app_action_list() {
  541.     _arguments \
  542.         '1::App name:->app' \
  543.         $help_option
  544. }
  545. _yunohost_app_action_run() {
  546.     _arguments \
  547.         '1::App name:->app' \
  548.         '2::Action ID:->action' \
  549.         $help_option \
  550.         '(-a --args)'{-a,--args}'+[Serialized arguments for app script (i.e. "domain=domain.tld&path=/path" )]'
  551. }
  552. # }}}
  553. # ------ App Action -----------------------------------------------
  554. # {{{
  555. _yunohost_app_config() {
  556.     if (( CURRENT > 2 )); then
  557.         __jump
  558.     else
  559.         local -a yunohost_app_config; yunohost_app_config=(
  560.             'show-panel:show config panel for the application'
  561.             'apply:apply the new configuration'
  562.         )
  563.         _describe -V -t yunohost-app-config 'yunohost app config subaction' yunohost_app_config "$@"
  564.     fi
  565. }
  566. _yunohost_app_action_show-panel() {
  567.     _arguments \
  568.         '1::App name:->app' \
  569.         $help_option
  570. }
  571. _yunohost_app_action_apply() {
  572.     _arguments \
  573.         '1::App name:->app' \
  574.         '2::Action ID:->action' \
  575.         $help_option \
  576.         '(-a --args)'{-a,--args}'+[Serialized arguments for app script (i.e. "domain=domain.tld&path=/path" )]'
  577. }
  578. # }}}
  579. # -------- Backup --------------------------------------- {{{
  580. _yunohost_backup_actions() {
  581.     typeset -a _backup
  582.     _backup=(
  583.  'create:Create a backup local archive. If neither --apps or --system are given, this will backup all apps and all system parts. If only --apps if given, this will only backup apps and no system parts. Similarly, if only --system is given, this will only backup system parts and no apps.'
  584.  'restore:Restore from a local backup archive. If neither --apps or --system are given, this will restore all apps and all system parts in the archive. If only --apps if given, this will only restore apps and no system parts. Similarly, if only --system is given, this will only restore system parts and no apps.'
  585.  'list:List available local backup archives'
  586.  'info:Show info about a local backup archive'
  587.  'delete:Delete a backup archive'
  588.     )
  589. }
  590. # }}}
  591. # run the main dispatcher
  592. _yunohost "$@"


Message édité par fol_de_dol le 16-02-2019 à 13:35:34
mood
Publicité
Posté le 16-02-2019 à 11:41:03  profilanswer
 


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Linux et OS Alternatifs
  Codes et scripts

  [ZSH] Yunohost, avis sur un plugin de completion

 

Sujets relatifs
Probleme installation plugin OMVAvis navigateur Brave
probleme d'instalation impossible plugin omv-extrasOutil de sauvegarde fichiers + mysql : vos avis ?
Shinken - Avis, retour d'expérience et testMinor et Major pagefault - avis aux experts linux !
Avis sur un script d'analyse de logsAvis sur Lenovo G50-70 ou ASUS-F551CA-Intel-Core-i3-3217U?
Vos avis sur les distributons Linux à prendrejaimerais avoir votre votre avis sur mon dernier projet en python
Plus de sujets relatifs à : [ZSH] Yunohost, avis sur un plugin de completion


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR