ldapsaisie/doc/dist/4.2.0-1-56-g22a5be4d/contrib/addons/cli-commands/index.html

3903 lines
No EOL
98 KiB
HTML

<!doctype html>
<html lang="fr" class="no-js">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="description" content="Documentation">
<meta name="author" content="Benjamin Renard <brenard@easter-eggs.com / brenard@zionetrix.net>">
<link rel="canonical" href="https://ldapsaisie.org/doc/dev/contrib/addons/cli-commands/">
<link rel="prev" href="../custom-views/">
<link rel="next" href="../../form-elements/">
<link rel="icon" href="../../../assets/images/favicon.png">
<meta name="generator" content="mkdocs-1.6.1, mkdocs-material-9.5.48">
<title>Les commandes CLI personnalisées - LdapSaisie</title>
<link rel="stylesheet" href="../../../assets/stylesheets/main.6f8fc17f.min.css">
<link rel="stylesheet" href="../../../assets/stylesheets/palette.06af60db.min.css">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,300i,400,400i,700,700i%7CRoboto+Mono:400,400i,700,700i&display=fallback">
<style>:root{--md-text-font:"Roboto";--md-code-font:"Roboto Mono"}</style>
<link rel="stylesheet" href="../../../css/print-site.css">
<link rel="stylesheet" href="../../../css/print-site-material.css">
<script>__md_scope=new URL("../../..",location),__md_hash=e=>[...e].reduce(((e,_)=>(e<<5)-e+_.charCodeAt(0)),0),__md_get=(e,_=localStorage,t=__md_scope)=>JSON.parse(_.getItem(t.pathname+"."+e)),__md_set=(e,_,t=localStorage,a=__md_scope)=>{try{t.setItem(a.pathname+"."+e,JSON.stringify(_))}catch(e){}}</script>
</head>
<body dir="ltr" data-md-color-scheme="default" data-md-color-primary="light-blue" data-md-color-accent="blue">
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
<label class="md-overlay" for="__drawer"></label>
<div data-md-component="skip">
<a href="#les-commandes-cli-personnalisees" class="md-skip">
Aller au contenu
</a>
</div>
<div data-md-component="announce">
</div>
<div data-md-color-scheme="default" data-md-component="outdated" hidden>
</div>
<header class="md-header md-header--shadow" data-md-component="header">
<nav class="md-header__inner md-grid" aria-label="En-tête">
<a href="https://ldapsaisie.org" title="LdapSaisie" class="md-header__button md-logo" aria-label="LdapSaisie" data-md-component="logo">
<img src="../../../assets/images/logo.png" alt="logo">
</a>
<label class="md-header__button md-icon" for="__drawer">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 6h18v2H3zm0 5h18v2H3zm0 5h18v2H3z"/></svg>
</label>
<div class="md-header__title" data-md-component="header-title">
<div class="md-header__ellipsis">
<div class="md-header__topic">
<span class="md-ellipsis">
LdapSaisie
</span>
</div>
<div class="md-header__topic" data-md-component="header-topic">
<span class="md-ellipsis">
Les commandes CLI personnalisées
</span>
</div>
</div>
</div>
<label class="md-header__button md-icon" for="__search">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.52 6.52 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5"/></svg>
</label>
<div class="md-search" data-md-component="search" role="dialog">
<label class="md-search__overlay" for="__search"></label>
<div class="md-search__inner" role="search">
<form class="md-search__form" name="search">
<input type="text" class="md-search__input" name="query" aria-label="Rechercher" placeholder="Rechercher" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="search-query" required>
<label class="md-search__icon md-icon" for="__search">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.52 6.52 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11z"/></svg>
</label>
<nav class="md-search__options" aria-label="Recherche">
<button type="reset" class="md-search__icon md-icon" title="Effacer" aria-label="Effacer" tabindex="-1">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/></svg>
</button>
</nav>
</form>
<div class="md-search__output">
<div class="md-search__scrollwrap" tabindex="0" data-md-scrollfix>
<div class="md-search-result" data-md-component="search-result">
<div class="md-search-result__meta">
Initialisation de la recherche
</div>
<ol class="md-search-result__list" role="presentation"></ol>
</div>
</div>
</div>
</div>
</div>
<div class="md-header__source">
<a href="https://gitlab.easter-eggs.com/ee/ldapsaisie" title="Aller au dépôt" class="md-source" data-md-component="source">
<div class="md-source__icon md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Free 6.7.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2024 Fonticons, Inc.--><path d="M439.55 236.05 244 40.45a28.87 28.87 0 0 0-40.81 0l-40.66 40.63 51.52 51.52c27.06-9.14 52.68 16.77 43.39 43.68l49.66 49.66c34.23-11.8 61.18 31 35.47 56.69-26.49 26.49-70.21-2.87-56-37.34L240.22 199v121.85c25.3 12.54 22.26 41.85 9.08 55a34.34 34.34 0 0 1-48.55 0c-17.57-17.6-11.07-46.91 11.25-56v-123c-20.8-8.51-24.6-30.74-18.64-45L142.57 101 8.45 235.14a28.86 28.86 0 0 0 0 40.81l195.61 195.6a28.86 28.86 0 0 0 40.8 0l194.69-194.69a28.86 28.86 0 0 0 0-40.81"/></svg>
</div>
<div class="md-source__repository">
ee/ldapsaisie
</div>
</a>
</div>
</nav>
</header>
<div class="md-container" data-md-component="container">
<main class="md-main" data-md-component="main">
<div class="md-main__inner md-grid">
<div class="md-sidebar md-sidebar--primary" data-md-component="sidebar" data-md-type="navigation" >
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--primary" aria-label="Navigation" data-md-level="0">
<label class="md-nav__title" for="__drawer">
<a href="https://ldapsaisie.org" title="LdapSaisie" class="md-nav__button md-logo" aria-label="LdapSaisie" data-md-component="logo">
<img src="../../../assets/images/logo.png" alt="logo">
</a>
LdapSaisie
</label>
<div class="md-nav__source">
<a href="https://gitlab.easter-eggs.com/ee/ldapsaisie" title="Aller au dépôt" class="md-source" data-md-component="source">
<div class="md-source__icon md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Free 6.7.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2024 Fonticons, Inc.--><path d="M439.55 236.05 244 40.45a28.87 28.87 0 0 0-40.81 0l-40.66 40.63 51.52 51.52c27.06-9.14 52.68 16.77 43.39 43.68l49.66 49.66c34.23-11.8 61.18 31 35.47 56.69-26.49 26.49-70.21-2.87-56-37.34L240.22 199v121.85c25.3 12.54 22.26 41.85 9.08 55a34.34 34.34 0 0 1-48.55 0c-17.57-17.6-11.07-46.91 11.25-56v-123c-20.8-8.51-24.6-30.74-18.64-45L142.57 101 8.45 235.14a28.86 28.86 0 0 0 0 40.81l195.61 195.6a28.86 28.86 0 0 0 40.8 0l194.69-194.69a28.86 28.86 0 0 0 0-40.81"/></svg>
</div>
<div class="md-source__repository">
ee/ldapsaisie
</div>
</a>
</div>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../.." class="md-nav__link">
<span class="md-ellipsis">
Introduction
</span>
</a>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_2" >
<label class="md-nav__link" for="__nav_2" id="__nav_2_label" tabindex="0">
<span class="md-ellipsis">
Installation
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_2_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_2">
<span class="md-nav__icon md-icon"></span>
Installation
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../../install/requirements/" class="md-nav__link">
<span class="md-ellipsis">
Pré-requis
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../install/download/" class="md-nav__link">
<span class="md-ellipsis">
Téléchargement
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../install/arbo/" class="md-nav__link">
<span class="md-ellipsis">
Arborescence du projet
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../install/howto/" class="md-nav__link">
<span class="md-ellipsis">
Tutoriel d'installation
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_3" >
<label class="md-nav__link" for="__nav_3" id="__nav_3_label" tabindex="0">
<span class="md-ellipsis">
Mise à jour
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_3_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_3">
<span class="md-nav__icon md-icon"></span>
Mise à jour
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../../upgrade/" class="md-nav__link">
<span class="md-ellipsis">
Instroduction
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../upgrade/method/" class="md-nav__link">
<span class="md-ellipsis">
Procédure de mise à jour
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../upgrade/2_4_1-to-3_0_0/" class="md-nav__link">
<span class="md-ellipsis">
2.4.1 -> 3.0.0
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_4" >
<label class="md-nav__link" for="__nav_4" id="__nav_4_label" tabindex="0">
<span class="md-ellipsis">
Configuration
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_4_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_4">
<span class="md-nav__icon md-icon"></span>
Configuration
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../../conf/" class="md-nav__link">
<span class="md-ellipsis">
Introduction
</span>
</a>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_4_2" >
<label class="md-nav__link" for="__nav_4_2" id="__nav_4_2_label" tabindex="0">
<span class="md-ellipsis">
Configuration globale
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="2" aria-labelledby="__nav_4_2_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_4_2">
<span class="md-nav__icon md-icon"></span>
Configuration globale
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../../conf/global/" class="md-nav__link">
<span class="md-ellipsis">
Introduction
</span>
</a>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_4_2_2" >
<label class="md-nav__link" for="__nav_4_2_2" id="__nav_4_2_2_label" tabindex="0">
<span class="md-ellipsis">
Connexion LDAP
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="3" aria-labelledby="__nav_4_2_2_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_4_2_2">
<span class="md-nav__icon md-icon"></span>
Connexion LDAP
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../../conf/global/ldap/" class="md-nav__link">
<span class="md-ellipsis">
Configuration des serveurs LDAP
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/global/ldap/LSprofile/" class="md-nav__link">
<span class="md-ellipsis">
Profils d'utilisateurs (LSprofile)
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/global/ldap/subDn/" class="md-nav__link">
<span class="md-ellipsis">
Sous-niveaux de connexion (subDn)
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/global/ldap/recoverPassword/" class="md-nav__link">
<span class="md-ellipsis">
Récupération de mot de passe
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="../../../conf/global/LSlog/" class="md-nav__link">
<span class="md-ellipsis">
Configuration de la journalisation (LSlog)
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/global/LSformat/" class="md-nav__link">
<span class="md-ellipsis">
Format paramétrable (LSformat)
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/global/LDAP_search_params/" class="md-nav__link">
<span class="md-ellipsis">
Paramètres étendus des recherches dans l'annuaire
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_4_3" >
<label class="md-nav__link" for="__nav_4_3" id="__nav_4_3_label" tabindex="0">
<span class="md-ellipsis">
Objets de l'annuaire
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="2" aria-labelledby="__nav_4_3_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_4_3">
<span class="md-nav__icon md-icon"></span>
Objets de l'annuaire
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../../conf/LSobject/" class="md-nav__link">
<span class="md-ellipsis">
Configuration LSobject
</span>
</a>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_4_3_2" >
<label class="md-nav__link" for="__nav_4_3_2" id="__nav_4_3_2_label" tabindex="0">
<span class="md-ellipsis">
Attributs
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="3" aria-labelledby="__nav_4_3_2_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_4_3_2">
<span class="md-nav__icon md-icon"></span>
Attributs
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/" class="md-nav__link">
<span class="md-ellipsis">
Configuration des attributs
</span>
</a>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_4_3_2_2" >
<label class="md-nav__link" for="__nav_4_3_2_2" id="__nav_4_3_2_2_label" tabindex="0">
<span class="md-ellipsis">
Types d'attribut LDAP (LSattr_ldap)
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="4" aria-labelledby="__nav_4_3_2_2_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_4_3_2_2">
<span class="md-nav__icon md-icon"></span>
Types d'attribut LDAP (LSattr_ldap)
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/LSattr_ldap/" class="md-nav__link">
<span class="md-ellipsis">
Introduction
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/LSattr_ldap/LSattr_ldap_ascii/" class="md-nav__link">
<span class="md-ellipsis">
ascii
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/LSattr_ldap/LSattr_ldap_boolean/" class="md-nav__link">
<span class="md-ellipsis">
boolean
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/LSattr_ldap/LSattr_ldap_compositeValueToJSON/" class="md-nav__link">
<span class="md-ellipsis">
compositeValueToJson
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/LSattr_ldap/LSattr_ldap_date/" class="md-nav__link">
<span class="md-ellipsis">
date
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/LSattr_ldap/LSattr_ldap_image/" class="md-nav__link">
<span class="md-ellipsis">
image
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/LSattr_ldap/LSattr_ldap_naiveDate/" class="md-nav__link">
<span class="md-ellipsis">
naiveDate
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/LSattr_ldap/LSattr_ldap_numeric/" class="md-nav__link">
<span class="md-ellipsis">
numeric
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/LSattr_ldap/LSattr_ldap_password/" class="md-nav__link">
<span class="md-ellipsis">
password
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/LSattr_ldap/LSattr_ldap_postaladdress/" class="md-nav__link">
<span class="md-ellipsis">
postaladdress
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/LSattr_ldap/LSattr_ldap_pwdHistory/" class="md-nav__link">
<span class="md-ellipsis">
pwdHistory
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/LSattr_ldap/LSattr_ldap_sambaAcctFlags/" class="md-nav__link">
<span class="md-ellipsis">
sambaAcctFlags
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/LSattr_ldap/LSattr_ldap_shadowExpire/" class="md-nav__link">
<span class="md-ellipsis">
shadowExpire
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_4_3_2_3" >
<label class="md-nav__link" for="__nav_4_3_2_3" id="__nav_4_3_2_3_label" tabindex="0">
<span class="md-ellipsis">
Types d'attribut HTML (LSattr_html)
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="4" aria-labelledby="__nav_4_3_2_3_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_4_3_2_3">
<span class="md-nav__icon md-icon"></span>
Types d'attribut HTML (LSattr_html)
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/LSattr_html/" class="md-nav__link">
<span class="md-ellipsis">
Introduction
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/LSattr_html/LSattr_html_boolean/" class="md-nav__link">
<span class="md-ellipsis">
boolean
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/LSattr_html/LSattr_html_date/" class="md-nav__link">
<span class="md-ellipsis">
date
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/LSattr_html/LSattr_html_gpg_pub_key/" class="md-nav__link">
<span class="md-ellipsis">
gpg_pub_key
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/LSattr_html/LSattr_html_image/" class="md-nav__link">
<span class="md-ellipsis">
image
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/LSattr_html/LSattr_html_jsonCompositeAttribute/" class="md-nav__link">
<span class="md-ellipsis">
jsonCompositeAttribute
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/LSattr_html/LSattr_html_labeledValue/" class="md-nav__link">
<span class="md-ellipsis">
labeledValue
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/LSattr_html/LSattr_html_mail/" class="md-nav__link">
<span class="md-ellipsis">
mail
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/LSattr_html/LSattr_html_maildir/" class="md-nav__link">
<span class="md-ellipsis">
maildir
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/LSattr_html/LSattr_html_mailQuota/" class="md-nav__link">
<span class="md-ellipsis">
mailQuota
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/LSattr_html/LSattr_html_password/" class="md-nav__link">
<span class="md-ellipsis">
password
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/LSattr_html/LSattr_html_postaladdress/" class="md-nav__link">
<span class="md-ellipsis">
postaladdress
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/LSattr_html/LSattr_html_pre/" class="md-nav__link">
<span class="md-ellipsis">
pre
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/LSattr_html/LSattr_html_rss/" class="md-nav__link">
<span class="md-ellipsis">
rss
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/LSattr_html/LSattr_html_sambaAcctFlags/" class="md-nav__link">
<span class="md-ellipsis">
sambaAcctFlags
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/LSattr_html/LSattr_html_select_box/" class="md-nav__link">
<span class="md-ellipsis">
select_box
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/LSattr_html/LSattr_html_select_list/" class="md-nav__link">
<span class="md-ellipsis">
select_list
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/LSattr_html/LSattr_html_select_object/" class="md-nav__link">
<span class="md-ellipsis">
select_object
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/LSattr_html/LSattr_html_ssh_key/" class="md-nav__link">
<span class="md-ellipsis">
ssh_key
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/LSattr_html/LSattr_html_tel/" class="md-nav__link">
<span class="md-ellipsis">
tel
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/LSattr_html/LSattr_html_text/" class="md-nav__link">
<span class="md-ellipsis">
text
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/LSattr_html/LSattr_html_textarea/" class="md-nav__link">
<span class="md-ellipsis">
textarea
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/LSattr_html/LSattr_html_url/" class="md-nav__link">
<span class="md-ellipsis">
url
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/LSattr_html/LSattr_html_valueWithUnit/" class="md-nav__link">
<span class="md-ellipsis">
valueWithUnit
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/LSattr_html/LSattr_html_wysiwyg/" class="md-nav__link">
<span class="md-ellipsis">
wysiwyg
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/LSattr_html/LSattr_html_xmpp/" class="md-nav__link">
<span class="md-ellipsis">
xmpp
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_4_3_2_4" >
<label class="md-nav__link" for="__nav_4_3_2_4" id="__nav_4_3_2_4_label" tabindex="0">
<span class="md-ellipsis">
Règles de vérification syntaxique (LSformRule)
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="4" aria-labelledby="__nav_4_3_2_4_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_4_3_2_4">
<span class="md-nav__icon md-icon"></span>
Règles de vérification syntaxique (LSformRule)
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/check_data/" class="md-nav__link">
<span class="md-ellipsis">
Introduction
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/check_data/alphanumeric/" class="md-nav__link">
<span class="md-ellipsis">
alphanumeric
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/check_data/callable/" class="md-nav__link">
<span class="md-ellipsis">
callable
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/check_data/date/" class="md-nav__link">
<span class="md-ellipsis">
date
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/check_data/differentPassword/" class="md-nav__link">
<span class="md-ellipsis">
differentPassword
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/check_data/email/" class="md-nav__link">
<span class="md-ellipsis">
email
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/check_data/filesize/" class="md-nav__link">
<span class="md-ellipsis">
filesize
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/check_data/gpg_pub_key/" class="md-nav__link">
<span class="md-ellipsis">
gpg_pub_key
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/check_data/imagefile/" class="md-nav__link">
<span class="md-ellipsis">
imagefile
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/check_data/imagesize/" class="md-nav__link">
<span class="md-ellipsis">
imagesize
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/check_data/inarray/" class="md-nav__link">
<span class="md-ellipsis">
inarray
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/check_data/integer/" class="md-nav__link">
<span class="md-ellipsis">
integer
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/check_data/ldapSearchURI/" class="md-nav__link">
<span class="md-ellipsis">
ldapSearchURI
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/check_data/lettersonly/" class="md-nav__link">
<span class="md-ellipsis">
lettersonly
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/check_data/maxlength/" class="md-nav__link">
<span class="md-ellipsis">
maxlength
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/check_data/mimetype/" class="md-nav__link">
<span class="md-ellipsis">
mimetype
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/check_data/minlength/" class="md-nav__link">
<span class="md-ellipsis">
minlength
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/check_data/nonzero/" class="md-nav__link">
<span class="md-ellipsis">
nonzero
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/check_data/nopunctuation/" class="md-nav__link">
<span class="md-ellipsis">
nopunctuation
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/check_data/numberOfValues/" class="md-nav__link">
<span class="md-ellipsis">
numberOfValues
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/check_data/numeric/" class="md-nav__link">
<span class="md-ellipsis">
numeric
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/check_data/password/" class="md-nav__link">
<span class="md-ellipsis">
password
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/check_data/rangelength/" class="md-nav__link">
<span class="md-ellipsis">
rangelength
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/check_data/regex/" class="md-nav__link">
<span class="md-ellipsis">
regex
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/check_data/required/" class="md-nav__link">
<span class="md-ellipsis">
required
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/check_data/ssh_pub_key/" class="md-nav__link">
<span class="md-ellipsis">
ssh_pub_key
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/check_data/telephonenumber/" class="md-nav__link">
<span class="md-ellipsis">
telephonenumber
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/check_data/zxcvbn/" class="md-nav__link">
<span class="md-ellipsis">
zxcvbn
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/validation/" class="md-nav__link">
<span class="md-ellipsis">
Règles de vérification d'intégrité
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSattribute/triggers/" class="md-nav__link">
<span class="md-ellipsis">
Déclencheurs
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/container_auto_create/" class="md-nav__link">
<span class="md-ellipsis">
Création automatique du conteneur des LSobjets dans un subDn
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/triggers/" class="md-nav__link">
<span class="md-ellipsis">
Déclencheurs
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/customActions/" class="md-nav__link">
<span class="md-ellipsis">
Actions personnalisées (customActions)
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSrelation/" class="md-nav__link">
<span class="md-ellipsis">
Les relations entre les objets de l'annuire (LSrelation)
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSform/" class="md-nav__link">
<span class="md-ellipsis">
Les formulaires (LSform)
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/LSsearch/" class="md-nav__link">
<span class="md-ellipsis">
Recherche des objets dans l'annuaire (LSsearch)
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSobject/ioFormat/" class="md-nav__link">
<span class="md-ellipsis">
Les formats d'import/export (ioFormat)
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_4_4" >
<label class="md-nav__link" for="__nav_4_4" id="__nav_4_4_label" tabindex="0">
<span class="md-ellipsis">
Configuration des addons (LSaddons)
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="2" aria-labelledby="__nav_4_4_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_4_4">
<span class="md-nav__icon md-icon"></span>
Configuration des addons (LSaddons)
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../../conf/LSaddon/" class="md-nav__link">
<span class="md-ellipsis">
Introduction
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSaddon/LSaddon_accesslog/" class="md-nav__link">
<span class="md-ellipsis">
accesslog
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSaddon/LSaddon_asterisk/" class="md-nav__link">
<span class="md-ellipsis">
asterisk
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSaddon/LSaddon_exportSearchResultAsCSV/" class="md-nav__link">
<span class="md-ellipsis">
exportSearchResultAsCSV
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSaddon/LSaddon_impersonate/" class="md-nav__link">
<span class="md-ellipsis">
impersonate
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSaddon/LSaddon_LSaccessRightsMatrixView/" class="md-nav__link">
<span class="md-ellipsis">
LSaccessRightsMatrixView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSaddon/LSaddon_mail/" class="md-nav__link">
<span class="md-ellipsis">
mail
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSaddon/LSaddon_maildir/" class="md-nav__link">
<span class="md-ellipsis">
maildir
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSaddon/LSaddon_mailquota/" class="md-nav__link">
<span class="md-ellipsis">
mailquota
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSaddon/LSaddon_phpldapadmin/" class="md-nav__link">
<span class="md-ellipsis">
phpldapadmin
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSaddon/LSaddon_ppolicy/" class="md-nav__link">
<span class="md-ellipsis">
ppolicy
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSaddon/LSaddon_showSupportInfo/" class="md-nav__link">
<span class="md-ellipsis">
showSupportInfo
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSaddon/LSaddon_showTechInfo/" class="md-nav__link">
<span class="md-ellipsis">
showTechInfo
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_4_5" >
<label class="md-nav__link" for="__nav_4_5" id="__nav_4_5_label" tabindex="0">
<span class="md-ellipsis">
Configuration des méthodes d'authentification (LSauthMethod)
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="2" aria-labelledby="__nav_4_5_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_4_5">
<span class="md-nav__icon md-icon"></span>
Configuration des méthodes d'authentification (LSauthMethod)
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../../conf/LSauthMethod/" class="md-nav__link">
<span class="md-ellipsis">
Introduction
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSauthMethod/LSauthMethod_anonymous/" class="md-nav__link">
<span class="md-ellipsis">
anonymous
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSauthMethod/LSauthMethod_CAS/" class="md-nav__link">
<span class="md-ellipsis">
CAS
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../conf/LSauthMethod/LSauthMethod_HTTP/" class="md-nav__link">
<span class="md-ellipsis">
HTTP
</span>
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="../../../api/" class="md-nav__link">
<span class="md-ellipsis">
API
</span>
</a>
</li>
<li class="md-nav__item md-nav__item--active md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_6" checked>
<label class="md-nav__link" for="__nav_6" id="__nav_6_label" tabindex="0">
<span class="md-ellipsis">
Contribution
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_6_label" aria-expanded="true">
<label class="md-nav__title" for="__nav_6">
<span class="md-nav__icon md-icon"></span>
Contribution
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../" class="md-nav__link">
<span class="md-ellipsis">
Introduction
</span>
</a>
</li>
<li class="md-nav__item md-nav__item--active md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_6_2" checked>
<label class="md-nav__link" for="__nav_6_2" id="__nav_6_2_label" tabindex="0">
<span class="md-ellipsis">
Les addons (LSaddon)
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="2" aria-labelledby="__nav_6_2_label" aria-expanded="true">
<label class="md-nav__title" for="__nav_6_2">
<span class="md-nav__icon md-icon"></span>
Les addons (LSaddon)
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../" class="md-nav__link">
<span class="md-ellipsis">
Introduction
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../custom-views/" class="md-nav__link">
<span class="md-ellipsis">
Les vues personnalisées
</span>
</a>
</li>
<li class="md-nav__item md-nav__item--active">
<input class="md-nav__toggle md-toggle" type="checkbox" id="__toc">
<label class="md-nav__link md-nav__link--active" for="__toc">
<span class="md-ellipsis">
Les commandes CLI personnalisées
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<a href="./" class="md-nav__link md-nav__link--active">
<span class="md-ellipsis">
Les commandes CLI personnalisées
</span>
</a>
<nav class="md-nav md-nav--secondary" aria-label="Table des matières">
<label class="md-nav__title" for="__toc">
<span class="md-nav__icon md-icon"></span>
Table des matières
</label>
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
<li class="md-nav__item">
<a href="#introduction" class="md-nav__link">
<span class="md-ellipsis">
Introduction
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#outils-a-votre-disposition" class="md-nav__link">
<span class="md-ellipsis">
Outils à votre disposition
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#auto-completion" class="md-nav__link">
<span class="md-ellipsis">
Auto-complétion
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#exemple-dimplementation" class="md-nav__link">
<span class="md-ellipsis">
Exemple d'implémentation
</span>
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="../../form-elements/" class="md-nav__link">
<span class="md-ellipsis">
Les éléments des formulaires (LSformElement)
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../form-rules/" class="md-nav__link">
<span class="md-ellipsis">
Les règles de validation syntaxiques (LSformRule)
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="../../../print_page/" class="md-nav__link">
<span class="md-ellipsis">
Documentation
</span>
</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--secondary" aria-label="Table des matières">
<label class="md-nav__title" for="__toc">
<span class="md-nav__icon md-icon"></span>
Table des matières
</label>
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
<li class="md-nav__item">
<a href="#introduction" class="md-nav__link">
<span class="md-ellipsis">
Introduction
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#outils-a-votre-disposition" class="md-nav__link">
<span class="md-ellipsis">
Outils à votre disposition
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#auto-completion" class="md-nav__link">
<span class="md-ellipsis">
Auto-complétion
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#exemple-dimplementation" class="md-nav__link">
<span class="md-ellipsis">
Exemple d'implémentation
</span>
</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-content" data-md-component="content">
<article class="md-content__inner md-typeset">
<a href="../../../print_page/" title="Print Site" class="md-content__button md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18 3H6v4h12m1 5a1 1 0 0 1-1-1 1 1 0 0 1 1-1 1 1 0 0 1 1 1 1 1 0 0 1-1 1m-3 7H8v-5h8m3-6H5a3 3 0 0 0-3 3v6h4v4h12v-4h4v-6a3 3 0 0 0-3-3"/></svg>
</a>
<h1 id="les-commandes-cli-personnalisees">Les commandes <em>CLI</em> personnalisées</h1>
<h2 id="introduction">Introduction</h2>
<p>Les <a href="../../../conf/#configuration-des-lsaddons">LSaddons</a> peuvent fournir des commandes <em>CLI</em>
personnalisées qui seront accessibles via la commande <code>ldapsaisie</code> fournie avec l'application. Cela
peut, par exemple, vous permettre de rendre accessible en ligne de commandes une procédure
implémentée dans le code d'LdapSaisie et vous permettre de mettre en place une tâche planifiée
exécutant cette procédure régulièrement.</p>
<p>Pour mettre en place une telle commande <em>CLI</em> personnalisée, il est nécessaire de :</p>
<ul>
<li>Déclarer cette commande <em>CLI</em> personnalisée dans la fonction <code>LSaddon_[addon]_support</code> de l'addon
à l'aide de la méthode <code>LScli::add_command()</code> ;</li>
</ul>
<ul>
<li>Déclarer la fonction implémentant cette commande <em>CLI</em> personnalisée. Cette fonction acceptera,
en tant qu'unique paramètre, un tableau des arguments reçus lors de l'exécution de la commande et
retournera <code>True</code> ou <code>False</code> en cas de succès/d'erreur d'exécution de la commande. Cette valeur
de retour influencera le code retourné par la commande : <code>0</code> en cas de succès, <code>1</code> en cas
d'erreur.</li>
</ul>
<ul>
<li>Bien que cela ne soit pas obligatoire, il sera également possible de déclarer une fonction
permettant l'autocomplétion des arguments acceptés par la commande. Pour plus d'informations à ce
propos, reportez-vous à la <a href="#auto-completion">section dédiée</a>.</li>
</ul>
<h2 id="outils-a-votre-disposition">Outils à votre disposition</h2>
<p>Pour vous aider dans l'écriture de vos méthodes <em>CLI</em>, la classe <code>LScli</code> offre des méthodes
pour les tâches les plus courantes :</p>
<ul>
<li>
<p><code>LScli::usage($error, ...$extra_args)</code></p>
<p>Affichage du message d'aide de votre commande avant arrêt. Un message d'erreur peut également
être spécifié avec d'éventuels arguments supplémentaires pour le composer (via <code>sprintf()</code>). Si un
message d'erreur est fourni, le code de retour de la commande sera <code>1</code> et à défaut, <code>0</code>.</p>
</li>
</ul>
<ul>
<li>
<p><code>LScli::need_ldap_con()</code></p>
<p>Permet d'établir la connexion à l'annuaire LDAP (si ce n'est pas déjà fait).</p>
</li>
</ul>
<ul>
<li>
<p><code>LScli::run_external_command($command, $data_stdin=null, $escape_command_args=true, $cwd=null)</code> :</p>
<p>Permet d'exécuter une commande externe et de récupérer un tableau contenant le code de
retour de la commande exécutée, le contenu affiché sur la sortie standard et le contenu
affiché sur la sortie d'erreur.</p>
<p>La commande à exécuter peut être passée sous la forme d'une chaîne de caractères ou d'un
tableau de chaînes de caractères correspondant à la commande et ses arguments. Par défaut,
les caractères spéciaux contenus dans les paramètres passés à la commande seront
"échappés", mais il est possible de désactiver cela via le paramètre <code>$escape_command_args</code>.</p>
<p>Il est possible de fournir des données à passer à la commande via son entrée standard via
le paramètre <code>$data_stdin</code>.</p>
<p>Enfin, il est possible de spécifier l'emplacement du dossier courant d'exécution de la
commande via le paramètre <code>$cwd</code>.</p>
</li>
</ul>
<ul>
<li>
<p><code>LScli::confirm($question=null)</code></p>
<p>Permet de demander à l'utilisateur de confirmer quelque chose. La question à poser peut être
passée en paramètre et cette méthode retournera <code>true</code> ou <code>false</code> en fonction du choix de
l'utilisateur.</p>
</li>
</ul>
<ul>
<li>
<p><code>LScli::parse_arg_value($value, $custom_values=null)</code></p>
<p>Permet d'interpréter la valeur d'un argument fourni par l'utilisateur. Celui-ci pourra spécifier
le type de l'argument en préfixant l'argument de son type entre crochets (exemple : <code>[bool]1</code>,
types supportés : <code>string</code>, <code>str</code>, <code>bool</code>, <code>boolean</code>, <code>int</code>, <code>integer</code>, <code>float</code>, <code>array</code>) et à
défaut, la valeur sera analysée comme une valeur JSON permettant de passer des paramètres
complexes à vos méthodes (un tableau associatif arborescent par exemple).</p>
<p>Des valeurs particulières seront également analysées de manières prédéfinies si elles ne
sont pas préfixées d'un type particulier. C'est le cas par défaut des chaînes de
caractères <code>true</code> et <code>false</code> qui seront comprises comme des booléens et <code>null</code> qui sera
compris comme la valeur <code>NULL</code> au sens PHP.</p>
<p>Vous pouvez également spécifier vos propres valeurs particulières via l'argument
<code>$custom_values</code> sous la forme d'un tableau associatif dont les clés sont les valeurs
particulières fournies par l'utilisateur et la valeur correspondante, la valeur au sens
<em>PHP</em>.</p>
<p><strong>Important :</strong> l'analyse des valeurs particulières sera faite en mettant
<strong>en minuscule</strong> la valeur fournie par l'utilisateur. Il est donc important que vos
valeurs particulières spécifiées via l'argument <code>$custom_values</code> soient toutes en
minuscule.</p>
</li>
</ul>
<h2 id="auto-completion">Auto-complétion</h2>
<p>Lors de la déclaration de votre commande CLI personnalisée à l'aide de la méthode
<code>LScli::add_command()</code>, vous avez la possibilité de spécifier une fonction permettant
l'autocomplétion des arguments acceptés par celle-ci.</p>
<p>Cette fonction recevra en paramètre :</p>
<ul>
<li>
<p><code>$command_args</code></p>
<p>Un tableau des arguments déjà reçus par la commande.</p>
</li>
</ul>
<ul>
<li>
<p><code>$comp_word_num</code></p>
<p>Un entier indiquant le rang de l'argument que l'autocomplétion tente de compléter. Il peut
s'agir du rang d'un paramètre déjà fourni et présent dans le tableau <code>$command_args</code> ou bien
d'un rang supérieur aux nombres d'arguments déjà fournis à la commande et dans ce cas il s'agira
d'autocompléter tous potentiels autres arguments que pourrait accepter cette commande.</p>
</li>
</ul>
<ul>
<li>
<p><code>$comp_word</code></p>
<p>Une chaîne de caractères correspondant à ce qu'a déjà saisi l'utilisateur de l'argument que l'on
tente d'autocompléter. Cette chaîne de caractères peut être vide ou non, en fonction de s'il
s'agit d'un nouvel argument à autocompléter ou non.</p>
</li>
</ul>
<ul>
<li>
<p><code>$opts</code></p>
<p>Un tableau des potentiels arguments globaux acceptés par <em>LScli</em> dans le contexte actuel (par
exemple, <code>-d</code> ou <code>--debug</code> pour l'activation du mode debug). La réponse de cette fonction devra
inclure ces potentiels arguments si le contexte d'autocomplétion s'y prête (nouvel argument par
exemple).</p>
</li>
</ul>
<p>Pour finir, cette fonction devra retourner un tableau des potentielles valeurs que pourrait
prendre l'argument autocomplété. Si une unique proposition est faite à l'utilisateur, celle-ci
sera automatiquement proposée à l'utilisateur et à défaut, la liste des valeurs possibles lui
seront affichées.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Pour vous aider dans l'écriture d'une telle méthode d'autocomplétion, des méthodes statiques
sont fournies par la classe <code>LScli</code> pour les autocomplétions les plus courantes :</p>
<ul>
<li><code>LScli::autocomplete_class_name()</code> : Autocomplétion du nom d'une classe PHP.</li>
</ul>
<ul>
<li><code>LScli::autocomplete_addon_name()</code> : Autocomplétion du nom d'un
<a href="../../../conf/#configuration-des-lsaddons">LSaddon</a>.</li>
</ul>
<ul>
<li><code>LScli::autocomplete_int()</code> : Autocomplétion d'un nombre entier.</li>
</ul>
<ul>
<li><code>LScli::autocomplete_LSobject_types()</code> : Autocomplétion du nom d'un type
d'<a href="../../../conf/#configuration-lsobject">LSobject</a>.</li>
</ul>
<ul>
<li><code>LScli::autocomplete_LSobject_dn()</code> : Autocomplétion du DN d'un type précis
d'<a href="../../../conf/#configuration-lsobject">LSobject</a> de l'annuaire.</li>
</ul>
<ul>
<li><code>LScli::autocomplete_LSobject_attr_name()</code> : Autocomplétion du nom d'un attribut précis
pour un type d'<a href="../../../conf/#configuration-lsobject">LSobject</a> de l'annuaire.</li>
</ul>
<ul>
<li><code>LScli::autocomplete_LSobject_ioFormat()</code> : Autocomplétion du nom d'un
<a href="../../../conf/LSobject/ioFormat/#ioformat">ioFormat</a> pour un type
d'<a href="../../../conf/#configuration-lsobject">LSobject</a> de l'annuaire.</li>
</ul>
<ul>
<li><code>LScli::autocomplete_LSform_name()</code> : Autocomplétion du nom d'un formulaire de
l'application.</li>
</ul>
<p>Par ailleurs, la méthode <code>LScli::autocomplete_opts()</code> vous facilitera la construction de la
liste des valeurs d'autocomplétion de l'argument courant en fonction de ce qui a déjà été
saisi par l'utilisateur (paramètre <code>$comp_word</code>). Cette méthode s'occupera en l'occurrence de
filtrer parmi toutes les valeurs contextuelles possibles, celles qui correspondent au préfixe
fourni par l'utilisateur.</p>
</div>
<h2 id="exemple-dimplementation">Exemple d'implémentation</h2>
<p>Pour implémenter une telle commande <em>CLI</em> personnalisée, vous pouvez vous inspirer de l'exemple
fourni ci-dessous ou encore des commandes <em>CLI</em> fournies par les autres
<a href="../../../conf/#configuration-des-lsaddons">LSaddons</a> ou classes PHP de l'application.</p>
<p><strong>Structure du fichier includes/addons/LSaddons.[addon name].php :</strong></p>
<div class="highlight"><pre><span></span><code><a id="__codelineno-0-1" name="__codelineno-0-1" href="#__codelineno-0-1"></a><span class="cp">&lt;?php</span>
<a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a><span class="k">function</span> <span class="nf">LSaddon_myaddon_support</span><span class="p">()</span> <span class="p">{</span>
<a id="__codelineno-0-3" name="__codelineno-0-3" href="#__codelineno-0-3"></a>
<a id="__codelineno-0-4" name="__codelineno-0-4" href="#__codelineno-0-4"></a> <span class="nv">$retval</span><span class="o">=</span><span class="k">true</span><span class="p">;</span>
<a id="__codelineno-0-5" name="__codelineno-0-5" href="#__codelineno-0-5"></a>
<a id="__codelineno-0-6" name="__codelineno-0-6" href="#__codelineno-0-6"></a> <span class="c1"># Some other checks need to verify your addon support</span>
<a id="__codelineno-0-7" name="__codelineno-0-7" href="#__codelineno-0-7"></a>
<a id="__codelineno-0-8" name="__codelineno-0-8" href="#__codelineno-0-8"></a> <span class="k">if</span> <span class="p">(</span><span class="nv">$retval</span><span class="p">)</span> <span class="p">{</span>
<a id="__codelineno-0-9" name="__codelineno-0-9" href="#__codelineno-0-9"></a> <span class="k">if</span> <span class="p">(</span><span class="nb">php_sapi_name</span><span class="p">()</span> <span class="o">==</span> <span class="s1">&#39;cli&#39;</span><span class="p">)</span> <span class="p">{</span>
<a id="__codelineno-0-10" name="__codelineno-0-10" href="#__codelineno-0-10"></a> <span class="nx">LScli</span><span class="o">::</span><span class="na">add_command</span><span class="p">(</span>
<a id="__codelineno-0-11" name="__codelineno-0-11" href="#__codelineno-0-11"></a> <span class="c1"># The CLI command name (required)</span>
<a id="__codelineno-0-12" name="__codelineno-0-12" href="#__codelineno-0-12"></a> <span class="s1">&#39;my_custom_cli_cmd&#39;</span><span class="p">,</span>
<a id="__codelineno-0-13" name="__codelineno-0-13" href="#__codelineno-0-13"></a> <span class="c1"># The CLI command handler (must be callable, required)</span>
<a id="__codelineno-0-14" name="__codelineno-0-14" href="#__codelineno-0-14"></a> <span class="s1">&#39;cli_my_custom_cli_cmd&#39;</span><span class="p">,</span>
<a id="__codelineno-0-15" name="__codelineno-0-15" href="#__codelineno-0-15"></a> <span class="c1"># A short description of what this command does (required)</span>
<a id="__codelineno-0-16" name="__codelineno-0-16" href="#__codelineno-0-16"></a> <span class="s1">&#39;My custom CLI command&#39;</span><span class="p">,</span>
<a id="__codelineno-0-17" name="__codelineno-0-17" href="#__codelineno-0-17"></a> <span class="c1"># A short list of commands available arguments show in usage message</span>
<a id="__codelineno-0-18" name="__codelineno-0-18" href="#__codelineno-0-18"></a> <span class="c1"># (optional, default: false)</span>
<a id="__codelineno-0-19" name="__codelineno-0-19" href="#__codelineno-0-19"></a> <span class="s1">&#39;[arg1] [arg2] [...]&#39;</span><span class="p">,</span>
<a id="__codelineno-0-20" name="__codelineno-0-20" href="#__codelineno-0-20"></a> <span class="c1"># A long description of what this command does</span>
<a id="__codelineno-0-21" name="__codelineno-0-21" href="#__codelineno-0-21"></a> <span class="c1"># (optional, default: false)</span>
<a id="__codelineno-0-22" name="__codelineno-0-22" href="#__codelineno-0-22"></a> <span class="s1">&#39;This command permit to ...&#39;</span><span class="p">,</span>
<a id="__codelineno-0-23" name="__codelineno-0-23" href="#__codelineno-0-23"></a> <span class="c1"># Permit to define if this command need connection to LDAP server</span>
<a id="__codelineno-0-24" name="__codelineno-0-24" href="#__codelineno-0-24"></a> <span class="c1"># (optional, default: true)</span>
<a id="__codelineno-0-25" name="__codelineno-0-25" href="#__codelineno-0-25"></a> <span class="k">true</span><span class="p">,</span>
<a id="__codelineno-0-26" name="__codelineno-0-26" href="#__codelineno-0-26"></a> <span class="c1"># Callable of the CLI command arguments autocompleter</span>
<a id="__codelineno-0-27" name="__codelineno-0-27" href="#__codelineno-0-27"></a> <span class="c1"># (optional, default: null)</span>
<a id="__codelineno-0-28" name="__codelineno-0-28" href="#__codelineno-0-28"></a> <span class="s1">&#39;cli_my_custom_cli_cmd_autocompleter&#39;</span><span class="p">,</span>
<a id="__codelineno-0-29" name="__codelineno-0-29" href="#__codelineno-0-29"></a> <span class="c1"># Allow override if a command already exists with the same name</span>
<a id="__codelineno-0-30" name="__codelineno-0-30" href="#__codelineno-0-30"></a> <span class="c1"># (optional, default: null)</span>
<a id="__codelineno-0-31" name="__codelineno-0-31" href="#__codelineno-0-31"></a> <span class="k">true</span>
<a id="__codelineno-0-32" name="__codelineno-0-32" href="#__codelineno-0-32"></a> <span class="p">);</span>
<a id="__codelineno-0-33" name="__codelineno-0-33" href="#__codelineno-0-33"></a> <span class="p">}</span>
<a id="__codelineno-0-34" name="__codelineno-0-34" href="#__codelineno-0-34"></a> <span class="p">}</span>
<a id="__codelineno-0-35" name="__codelineno-0-35" href="#__codelineno-0-35"></a>
<a id="__codelineno-0-36" name="__codelineno-0-36" href="#__codelineno-0-36"></a> <span class="k">return</span> <span class="nv">$retval</span><span class="p">;</span>
<a id="__codelineno-0-37" name="__codelineno-0-37" href="#__codelineno-0-37"></a><span class="p">}</span>
<a id="__codelineno-0-38" name="__codelineno-0-38" href="#__codelineno-0-38"></a>
<a id="__codelineno-0-39" name="__codelineno-0-39" href="#__codelineno-0-39"></a><span class="p">[</span><span class="o">...</span><span class="p">]</span>
<a id="__codelineno-0-40" name="__codelineno-0-40" href="#__codelineno-0-40"></a>
<a id="__codelineno-0-41" name="__codelineno-0-41" href="#__codelineno-0-41"></a><span class="c1">// Defined CLI commands functions only on CLI context</span>
<a id="__codelineno-0-42" name="__codelineno-0-42" href="#__codelineno-0-42"></a><span class="k">if</span> <span class="p">(</span><span class="nb">php_sapi_name</span><span class="p">()</span> <span class="o">!=</span> <span class="s1">&#39;cli&#39;</span><span class="p">)</span>
<a id="__codelineno-0-43" name="__codelineno-0-43" href="#__codelineno-0-43"></a> <span class="k">return</span> <span class="k">true</span><span class="p">;</span> <span class="c1">// Always return true to avoid some warning in log</span>
<a id="__codelineno-0-44" name="__codelineno-0-44" href="#__codelineno-0-44"></a>
<a id="__codelineno-0-45" name="__codelineno-0-45" href="#__codelineno-0-45"></a><span class="sd">/**</span>
<a id="__codelineno-0-46" name="__codelineno-0-46" href="#__codelineno-0-46"></a><span class="sd"> * My addon CLI command my_custom_cli_cmd handler function</span>
<a id="__codelineno-0-47" name="__codelineno-0-47" href="#__codelineno-0-47"></a><span class="sd"> *</span>
<a id="__codelineno-0-48" name="__codelineno-0-48" href="#__codelineno-0-48"></a><span class="sd"> * Description of this CLI command.</span>
<a id="__codelineno-0-49" name="__codelineno-0-49" href="#__codelineno-0-49"></a><span class="sd"> *</span>
<a id="__codelineno-0-50" name="__codelineno-0-50" href="#__codelineno-0-50"></a><span class="sd"> * @param array $command_args Command arguments</span>
<a id="__codelineno-0-51" name="__codelineno-0-51" href="#__codelineno-0-51"></a><span class="sd"> * - Positional arguments :</span>
<a id="__codelineno-0-52" name="__codelineno-0-52" href="#__codelineno-0-52"></a><span class="sd"> * - LSobject</span>
<a id="__codelineno-0-53" name="__codelineno-0-53" href="#__codelineno-0-53"></a><span class="sd"> * - dn</span>
<a id="__codelineno-0-54" name="__codelineno-0-54" href="#__codelineno-0-54"></a><span class="sd"> * - Optional arguments :</span>
<a id="__codelineno-0-55" name="__codelineno-0-55" href="#__codelineno-0-55"></a><span class="sd"> * - -f|--force : Force mode</span>
<a id="__codelineno-0-56" name="__codelineno-0-56" href="#__codelineno-0-56"></a><span class="sd"> *</span>
<a id="__codelineno-0-57" name="__codelineno-0-57" href="#__codelineno-0-57"></a><span class="sd"> * @author My Name &lt;my.email@example.com&gt;</span>
<a id="__codelineno-0-58" name="__codelineno-0-58" href="#__codelineno-0-58"></a><span class="sd"> *</span>
<a id="__codelineno-0-59" name="__codelineno-0-59" href="#__codelineno-0-59"></a><span class="sd"> * @return boolean True on success, false otherwise</span>
<a id="__codelineno-0-60" name="__codelineno-0-60" href="#__codelineno-0-60"></a><span class="sd"> **/</span>
<a id="__codelineno-0-61" name="__codelineno-0-61" href="#__codelineno-0-61"></a><span class="k">function</span> <span class="nf">cli_my_custom_cli_cmd</span><span class="p">(</span><span class="nv">$command_args</span><span class="p">)</span> <span class="p">{</span>
<a id="__codelineno-0-62" name="__codelineno-0-62" href="#__codelineno-0-62"></a> <span class="nv">$objType</span> <span class="o">=</span> <span class="k">null</span><span class="p">;</span>
<a id="__codelineno-0-63" name="__codelineno-0-63" href="#__codelineno-0-63"></a> <span class="nv">$dn</span> <span class="o">=</span> <span class="k">null</span><span class="p">;</span>
<a id="__codelineno-0-64" name="__codelineno-0-64" href="#__codelineno-0-64"></a> <span class="nv">$force_mode</span> <span class="o">=</span> <span class="k">false</span><span class="p">;</span>
<a id="__codelineno-0-65" name="__codelineno-0-65" href="#__codelineno-0-65"></a> <span class="k">foreach</span> <span class="p">(</span><span class="nv">$command_args</span> <span class="k">as</span> <span class="nv">$arg</span><span class="p">)</span> <span class="p">{</span>
<a id="__codelineno-0-66" name="__codelineno-0-66" href="#__codelineno-0-66"></a> <span class="k">if</span> <span class="p">(</span><span class="nv">$arg</span> <span class="o">==</span> <span class="s1">&#39;-f&#39;</span> <span class="o">||</span> <span class="nv">$arg</span> <span class="o">==</span> <span class="s1">&#39;--force&#39;</span><span class="p">)</span>
<a id="__codelineno-0-67" name="__codelineno-0-67" href="#__codelineno-0-67"></a> <span class="nv">$force_mode</span> <span class="o">=</span> <span class="k">true</span><span class="p">;</span>
<a id="__codelineno-0-68" name="__codelineno-0-68" href="#__codelineno-0-68"></a> <span class="k">elseif</span> <span class="p">(</span><span class="nb">is_null</span><span class="p">(</span><span class="nv">$objType</span><span class="p">))</span> <span class="p">{</span>
<a id="__codelineno-0-69" name="__codelineno-0-69" href="#__codelineno-0-69"></a> <span class="nv">$objType</span> <span class="o">=</span> <span class="nv">$arg</span><span class="p">;</span>
<a id="__codelineno-0-70" name="__codelineno-0-70" href="#__codelineno-0-70"></a> <span class="p">}</span>
<a id="__codelineno-0-71" name="__codelineno-0-71" href="#__codelineno-0-71"></a> <span class="k">elseif</span> <span class="p">(</span><span class="nb">is_null</span><span class="p">(</span><span class="nv">$dn</span><span class="p">))</span> <span class="p">{</span>
<a id="__codelineno-0-72" name="__codelineno-0-72" href="#__codelineno-0-72"></a> <span class="nv">$dn</span> <span class="o">=</span> <span class="nv">$arg</span><span class="p">;</span>
<a id="__codelineno-0-73" name="__codelineno-0-73" href="#__codelineno-0-73"></a> <span class="p">}</span>
<a id="__codelineno-0-74" name="__codelineno-0-74" href="#__codelineno-0-74"></a> <span class="k">else</span>
<a id="__codelineno-0-75" name="__codelineno-0-75" href="#__codelineno-0-75"></a> <span class="nx">LScli</span><span class="o">::</span><span class="na">usage</span><span class="p">(</span><span class="s2">&quot;Invalid </span><span class="si">$arg</span><span class="s2"> parameter.&quot;</span><span class="p">);</span>
<a id="__codelineno-0-76" name="__codelineno-0-76" href="#__codelineno-0-76"></a> <span class="p">}</span>
<a id="__codelineno-0-77" name="__codelineno-0-77" href="#__codelineno-0-77"></a>
<a id="__codelineno-0-78" name="__codelineno-0-78" href="#__codelineno-0-78"></a> <span class="k">if</span> <span class="p">(</span><span class="nb">is_null</span><span class="p">(</span><span class="nv">$objType</span><span class="p">)</span> <span class="o">||</span> <span class="nb">is_null</span><span class="p">(</span><span class="nv">$dn</span><span class="p">))</span>
<a id="__codelineno-0-79" name="__codelineno-0-79" href="#__codelineno-0-79"></a> <span class="nx">LScli</span><span class="o">::</span><span class="na">usage</span><span class="p">(</span><span class="s1">&#39;You must provide LSobject type and DN.&#39;</span><span class="p">);</span>
<a id="__codelineno-0-80" name="__codelineno-0-80" href="#__codelineno-0-80"></a>
<a id="__codelineno-0-81" name="__codelineno-0-81" href="#__codelineno-0-81"></a> <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nx">LSsession</span><span class="o">::</span><span class="na">loadLSobject</span><span class="p">(</span><span class="nv">$objType</span><span class="p">))</span>
<a id="__codelineno-0-82" name="__codelineno-0-82" href="#__codelineno-0-82"></a> <span class="k">return</span> <span class="k">false</span><span class="p">;</span>
<a id="__codelineno-0-83" name="__codelineno-0-83" href="#__codelineno-0-83"></a>
<a id="__codelineno-0-84" name="__codelineno-0-84" href="#__codelineno-0-84"></a> <span class="nv">$obj</span> <span class="o">=</span> <span class="k">new</span> <span class="nv">$objType</span><span class="p">();</span>
<a id="__codelineno-0-85" name="__codelineno-0-85" href="#__codelineno-0-85"></a> <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nv">$obj</span><span class="o">-&gt;</span><span class="na">loadData</span><span class="p">(</span><span class="nv">$dn</span><span class="p">))</span> <span class="p">{</span>
<a id="__codelineno-0-86" name="__codelineno-0-86" href="#__codelineno-0-86"></a> <span class="nx">self</span><span class="o">::</span><span class="na">log_fatal</span><span class="p">(</span><span class="s2">&quot;Fail to load object </span><span class="si">$dn</span><span class="s2"> data from LDAP&quot;</span><span class="p">);</span>
<a id="__codelineno-0-87" name="__codelineno-0-87" href="#__codelineno-0-87"></a> <span class="k">return</span> <span class="k">false</span><span class="p">;</span>
<a id="__codelineno-0-88" name="__codelineno-0-88" href="#__codelineno-0-88"></a> <span class="p">}</span>
<a id="__codelineno-0-89" name="__codelineno-0-89" href="#__codelineno-0-89"></a>
<a id="__codelineno-0-90" name="__codelineno-0-90" href="#__codelineno-0-90"></a> <span class="c1">// Do some stuff on loaded object</span>
<a id="__codelineno-0-91" name="__codelineno-0-91" href="#__codelineno-0-91"></a> <span class="p">[</span><span class="o">...</span><span class="p">]</span>
<a id="__codelineno-0-92" name="__codelineno-0-92" href="#__codelineno-0-92"></a>
<a id="__codelineno-0-93" name="__codelineno-0-93" href="#__codelineno-0-93"></a> <span class="k">return</span> <span class="k">true</span><span class="p">;</span>
<a id="__codelineno-0-94" name="__codelineno-0-94" href="#__codelineno-0-94"></a><span class="p">}</span>
<a id="__codelineno-0-95" name="__codelineno-0-95" href="#__codelineno-0-95"></a>
<a id="__codelineno-0-96" name="__codelineno-0-96" href="#__codelineno-0-96"></a><span class="sd">/**</span>
<a id="__codelineno-0-97" name="__codelineno-0-97" href="#__codelineno-0-97"></a><span class="sd"> * Args autocompleter for CLI my_custom_cli_cmd command</span>
<a id="__codelineno-0-98" name="__codelineno-0-98" href="#__codelineno-0-98"></a><span class="sd"> *</span>
<a id="__codelineno-0-99" name="__codelineno-0-99" href="#__codelineno-0-99"></a><span class="sd"> * @param array&lt;string&gt; $command_args List of already typed words of the command</span>
<a id="__codelineno-0-100" name="__codelineno-0-100" href="#__codelineno-0-100"></a><span class="sd"> * @param int $comp_word_num The command word number to autocomplete</span>
<a id="__codelineno-0-101" name="__codelineno-0-101" href="#__codelineno-0-101"></a><span class="sd"> * @param string $comp_word The command word to autocomplete</span>
<a id="__codelineno-0-102" name="__codelineno-0-102" href="#__codelineno-0-102"></a><span class="sd"> * @param array&lt;string&gt; $opts List of global available options</span>
<a id="__codelineno-0-103" name="__codelineno-0-103" href="#__codelineno-0-103"></a><span class="sd"> *</span>
<a id="__codelineno-0-104" name="__codelineno-0-104" href="#__codelineno-0-104"></a><span class="sd"> * @return array&lt;string&gt; List of available options for the word to autocomplete</span>
<a id="__codelineno-0-105" name="__codelineno-0-105" href="#__codelineno-0-105"></a><span class="sd"> **/</span>
<a id="__codelineno-0-106" name="__codelineno-0-106" href="#__codelineno-0-106"></a><span class="k">public</span> <span class="k">static</span> <span class="k">function</span> <span class="nf">cli_my_custom_cli_cmd_autocompleter</span><span class="p">(</span>
<a id="__codelineno-0-107" name="__codelineno-0-107" href="#__codelineno-0-107"></a> <span class="nv">$command_args</span><span class="p">,</span> <span class="nv">$comp_word_num</span><span class="p">,</span> <span class="nv">$comp_word</span><span class="p">,</span> <span class="nv">$opts</span>
<a id="__codelineno-0-108" name="__codelineno-0-108" href="#__codelineno-0-108"></a><span class="p">)</span> <span class="p">{</span>
<a id="__codelineno-0-109" name="__codelineno-0-109" href="#__codelineno-0-109"></a> <span class="nv">$opts</span> <span class="o">=</span> <span class="nb">array_merge</span><span class="p">(</span><span class="nv">$opts</span><span class="p">,</span> <span class="k">array</span> <span class="p">(</span><span class="s1">&#39;-f&#39;</span><span class="p">,</span> <span class="s1">&#39;--force&#39;</span><span class="p">));</span>
<a id="__codelineno-0-110" name="__codelineno-0-110" href="#__codelineno-0-110"></a>
<a id="__codelineno-0-111" name="__codelineno-0-111" href="#__codelineno-0-111"></a> <span class="c1">// Handle positional args</span>
<a id="__codelineno-0-112" name="__codelineno-0-112" href="#__codelineno-0-112"></a> <span class="nv">$objType</span> <span class="o">=</span> <span class="k">null</span><span class="p">;</span>
<a id="__codelineno-0-113" name="__codelineno-0-113" href="#__codelineno-0-113"></a> <span class="nv">$objType_arg_num</span> <span class="o">=</span> <span class="k">null</span><span class="p">;</span>
<a id="__codelineno-0-114" name="__codelineno-0-114" href="#__codelineno-0-114"></a> <span class="nv">$dn</span> <span class="o">=</span> <span class="k">null</span><span class="p">;</span>
<a id="__codelineno-0-115" name="__codelineno-0-115" href="#__codelineno-0-115"></a> <span class="nv">$dn_arg_num</span> <span class="o">=</span> <span class="k">null</span><span class="p">;</span>
<a id="__codelineno-0-116" name="__codelineno-0-116" href="#__codelineno-0-116"></a> <span class="k">for</span> <span class="p">(</span><span class="nv">$i</span><span class="o">=</span><span class="mi">0</span><span class="p">;</span> <span class="nv">$i</span> <span class="o">&lt;</span> <span class="nb">count</span><span class="p">(</span><span class="nv">$command_args</span><span class="p">);</span> <span class="nv">$i</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span>
<a id="__codelineno-0-117" name="__codelineno-0-117" href="#__codelineno-0-117"></a> <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nb">in_array</span><span class="p">(</span><span class="nv">$command_args</span><span class="p">[</span><span class="nv">$i</span><span class="p">],</span> <span class="nv">$opts</span><span class="p">))</span> <span class="p">{</span>
<a id="__codelineno-0-118" name="__codelineno-0-118" href="#__codelineno-0-118"></a> <span class="c1">// If object type not defined</span>
<a id="__codelineno-0-119" name="__codelineno-0-119" href="#__codelineno-0-119"></a> <span class="k">if</span> <span class="p">(</span><span class="nb">is_null</span><span class="p">(</span><span class="nv">$objType</span><span class="p">))</span> <span class="p">{</span>
<a id="__codelineno-0-120" name="__codelineno-0-120" href="#__codelineno-0-120"></a> <span class="c1">// Defined it</span>
<a id="__codelineno-0-121" name="__codelineno-0-121" href="#__codelineno-0-121"></a> <span class="nv">$objType</span> <span class="o">=</span> <span class="nv">$command_args</span><span class="p">[</span><span class="nv">$i</span><span class="p">];</span>
<a id="__codelineno-0-122" name="__codelineno-0-122" href="#__codelineno-0-122"></a> <span class="nx">LScli</span><span class="o">::</span><span class="na">unquote_word</span><span class="p">(</span><span class="nv">$objType</span><span class="p">);</span>
<a id="__codelineno-0-123" name="__codelineno-0-123" href="#__codelineno-0-123"></a> <span class="nv">$objType_arg_num</span> <span class="o">=</span> <span class="nv">$i</span><span class="p">;</span>
<a id="__codelineno-0-124" name="__codelineno-0-124" href="#__codelineno-0-124"></a>
<a id="__codelineno-0-125" name="__codelineno-0-125" href="#__codelineno-0-125"></a> <span class="c1">// Check object type exists</span>
<a id="__codelineno-0-126" name="__codelineno-0-126" href="#__codelineno-0-126"></a> <span class="nv">$objTypes</span> <span class="o">=</span> <span class="nx">LScli</span><span class="o">::</span><span class="na">autocomplete_LSobject_types</span><span class="p">(</span><span class="nv">$objType</span><span class="p">);</span>
<a id="__codelineno-0-127" name="__codelineno-0-127" href="#__codelineno-0-127"></a>
<a id="__codelineno-0-128" name="__codelineno-0-128" href="#__codelineno-0-128"></a> <span class="c1">// Load it if exist and not trying to complete it</span>
<a id="__codelineno-0-129" name="__codelineno-0-129" href="#__codelineno-0-129"></a> <span class="k">if</span> <span class="p">(</span><span class="nb">in_array</span><span class="p">(</span><span class="nv">$objType</span><span class="p">,</span> <span class="nv">$objTypes</span><span class="p">)</span> <span class="o">&amp;&amp;</span> <span class="nv">$i</span> <span class="o">!=</span> <span class="nv">$comp_word_num</span><span class="p">)</span> <span class="p">{</span>
<a id="__codelineno-0-130" name="__codelineno-0-130" href="#__codelineno-0-130"></a> <span class="nx">LSsession</span><span class="o">::</span><span class="na">loadLSobject</span><span class="p">(</span><span class="nv">$objType</span><span class="p">,</span> <span class="k">false</span><span class="p">);</span>
<a id="__codelineno-0-131" name="__codelineno-0-131" href="#__codelineno-0-131"></a> <span class="p">}</span>
<a id="__codelineno-0-132" name="__codelineno-0-132" href="#__codelineno-0-132"></a> <span class="p">}</span>
<a id="__codelineno-0-133" name="__codelineno-0-133" href="#__codelineno-0-133"></a> <span class="k">elseif</span> <span class="p">(</span><span class="nb">is_null</span><span class="p">(</span><span class="nv">$dn</span><span class="p">))</span> <span class="p">{</span>
<a id="__codelineno-0-134" name="__codelineno-0-134" href="#__codelineno-0-134"></a> <span class="nv">$dn</span> <span class="o">=</span> <span class="nv">$command_args</span><span class="p">[</span><span class="nv">$i</span><span class="p">];</span>
<a id="__codelineno-0-135" name="__codelineno-0-135" href="#__codelineno-0-135"></a> <span class="nx">LScli</span><span class="o">::</span><span class="na">unquote_word</span><span class="p">(</span><span class="nv">$dn</span><span class="p">);</span>
<a id="__codelineno-0-136" name="__codelineno-0-136" href="#__codelineno-0-136"></a> <span class="nv">$dn_arg_num</span> <span class="o">=</span> <span class="nv">$i</span><span class="p">;</span>
<a id="__codelineno-0-137" name="__codelineno-0-137" href="#__codelineno-0-137"></a> <span class="p">}</span>
<a id="__codelineno-0-138" name="__codelineno-0-138" href="#__codelineno-0-138"></a> <span class="p">}</span>
<a id="__codelineno-0-139" name="__codelineno-0-139" href="#__codelineno-0-139"></a> <span class="p">}</span>
<a id="__codelineno-0-140" name="__codelineno-0-140" href="#__codelineno-0-140"></a>
<a id="__codelineno-0-141" name="__codelineno-0-141" href="#__codelineno-0-141"></a> <span class="c1">// If objType not already chosen (or currently autocomplete),</span>
<a id="__codelineno-0-142" name="__codelineno-0-142" href="#__codelineno-0-142"></a> <span class="c1">// add LSobject types to available options</span>
<a id="__codelineno-0-143" name="__codelineno-0-143" href="#__codelineno-0-143"></a> <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nv">$objType</span> <span class="o">||</span> <span class="nv">$objType_arg_num</span> <span class="o">==</span> <span class="nv">$comp_word_num</span><span class="p">)</span>
<a id="__codelineno-0-144" name="__codelineno-0-144" href="#__codelineno-0-144"></a> <span class="nv">$opts</span> <span class="o">=</span> <span class="nb">array_merge</span><span class="p">(</span>
<a id="__codelineno-0-145" name="__codelineno-0-145" href="#__codelineno-0-145"></a> <span class="nv">$opts</span><span class="p">,</span>
<a id="__codelineno-0-146" name="__codelineno-0-146" href="#__codelineno-0-146"></a> <span class="nx">LScli</span><span class="o">::</span><span class="na">autocomplete_LSobject_types</span><span class="p">(</span><span class="nv">$comp_word</span><span class="p">)</span>
<a id="__codelineno-0-147" name="__codelineno-0-147" href="#__codelineno-0-147"></a> <span class="p">);</span>
<a id="__codelineno-0-148" name="__codelineno-0-148" href="#__codelineno-0-148"></a>
<a id="__codelineno-0-149" name="__codelineno-0-149" href="#__codelineno-0-149"></a> <span class="c1">// If dn not already chosen (or currently autocomplete), try autocomplete it</span>
<a id="__codelineno-0-150" name="__codelineno-0-150" href="#__codelineno-0-150"></a> <span class="k">elseif</span> <span class="p">(</span><span class="o">!</span><span class="nv">$dn</span> <span class="o">||</span> <span class="nv">$dn_arg_num</span> <span class="o">==</span> <span class="nv">$comp_word_num</span><span class="p">)</span>
<a id="__codelineno-0-151" name="__codelineno-0-151" href="#__codelineno-0-151"></a> <span class="nv">$opts</span> <span class="o">=</span> <span class="nb">array_merge</span><span class="p">(</span>
<a id="__codelineno-0-152" name="__codelineno-0-152" href="#__codelineno-0-152"></a> <span class="nv">$opts</span><span class="p">,</span>
<a id="__codelineno-0-153" name="__codelineno-0-153" href="#__codelineno-0-153"></a> <span class="nx">LScli</span><span class="o">::</span><span class="na">autocomplete_LSobject_dn</span><span class="p">(</span><span class="nv">$objType</span><span class="p">,</span> <span class="nv">$comp_word</span><span class="p">)</span>
<a id="__codelineno-0-154" name="__codelineno-0-154" href="#__codelineno-0-154"></a> <span class="p">);</span>
<a id="__codelineno-0-155" name="__codelineno-0-155" href="#__codelineno-0-155"></a>
<a id="__codelineno-0-156" name="__codelineno-0-156" href="#__codelineno-0-156"></a> <span class="k">return</span> <span class="nx">LScli</span><span class="o">::</span><span class="na">autocomplete_opts</span><span class="p">(</span><span class="nv">$opts</span><span class="p">,</span> <span class="nv">$comp_word</span><span class="p">);</span>
<a id="__codelineno-0-157" name="__codelineno-0-157" href="#__codelineno-0-157"></a><span class="p">}</span>
</code></pre></div>
</article>
</div>
<script>var target=document.getElementById(location.hash.slice(1));target&&target.name&&(target.checked=target.name.startsWith("__tabbed_"))</script>
</div>
</main>
<footer class="md-footer">
<div class="md-footer-meta md-typeset">
<div class="md-footer-meta__inner md-grid">
<div class="md-copyright">
<div class="md-copyright__highlight">
Easter-eggs
</div>
Made with
<a href="https://squidfunk.github.io/mkdocs-material/" target="_blank" rel="noopener">
Material for MkDocs
</a>
</div>
</div>
</div>
</footer>
</div>
<div class="md-dialog" data-md-component="dialog">
<div class="md-dialog__inner md-typeset"></div>
</div>
<script id="__config" type="application/json">{"base": "../../..", "features": [], "search": "../../../assets/javascripts/workers/search.6ce7567c.min.js", "translations": {"clipboard.copied": "Copi\u00e9 dans le presse-papier", "clipboard.copy": "Copier dans le presse-papier", "search.result.more.one": "1 de plus sur cette page", "search.result.more.other": "# de plus sur cette page", "search.result.none": "Aucun document trouv\u00e9", "search.result.one": "1 document trouv\u00e9", "search.result.other": "# documents trouv\u00e9s", "search.result.placeholder": "Taper pour d\u00e9marrer la recherche", "search.result.term.missing": "Non trouv\u00e9", "select.version": "S\u00e9lectionner la version"}, "version": {"provider": "mike"}}</script>
<script src="../../../assets/javascripts/bundle.83f73b43.min.js"></script>
<script src="../../../js/print-site.js"></script>
</body>
</html>