# Liste de commandes

## `login`

La commande `login` vous permet d'ajouter vos informations d'identification WorkflowGen pour autoriser l'interface de ligne de commande (CLI).

{% hint style="info" %}
Disponible depuis la version 7.0.0 de WorkflowGen.
{% endhint %}

{% hint style="warning" %}
La CLI WorkflowGen ne supporte pas l'authentification OpenID Connect (Auth0, Okta, Azure AD, AD FS).
{% endhint %}

#### Utilisation

```
wfg login [WORKFLOWGEN_URL] -u [WORKFLOWGEN_USERNAME] -p [WORKFLOWGEN_PASSWORD] -c [CONTEXT_NAME]
```

#### Arguments

| Nom   | Type   | Description     | Comportement |
| ----- | ------ | --------------- | ------------ |
| `url` | Chaîne | URL WorkflowGen | Requis       |

#### Options

| Alias                | Type   | Description                   | Valeur par défaut                          | Comportement |
| -------------------- | ------ | ----------------------------- | ------------------------------------------ | ------------ |
| `--username` ou `-u` | Chaîne | Nom d'utilisateur WorkflowGen | Aucune                                     | Requis       |
| `--password` ou `-p` | Chaîne | Mot de passe WorkflowGen      | Aucune                                     | Facultatif   |
| `--webforms` ou `-w` | Chaîne | Chemin des formulaires Web    | `C:\inetpub\wwwroot\wfgen\wfapps\webforms` | Facultatif   |
| `--context` ou `-c`  | Chaîne | Nom du contexte               | `DEFAULT`                                  | Facultatif   |

#### 📌 **Exemple**

```
wfg login http://localhost:8080/wfgen/ -u wfgen_admin -p YourPassword
```

## `config`

La commande `config` vous permet de configurer la CLI.

{% hint style="info" %}
Disponible depuis la version 7.0.0 de WorkflowGen.
{% endhint %}

### `current-context`

Affiche le contexte actuel.

#### **Utilisation**

```
wfg config current-context
```

### `delete-context`

Supprime le contexte spécifié de la configuration.

#### **Utilisation**

```
wfg config delete-context [CONTEXT_NAME]
```

{% hint style="info" %}
`[CONTEXT_NAME]` représente le nom donné au contexte CLI qui contient vos informations de serveur et d'utilisateur.
{% endhint %}

#### **Argument**

| Nom    | Type   | Description                 | Comportement |
| ------ | ------ | --------------------------- | ------------ |
| `name` | Chaîne | Nom du contexte à supprimer | Requis       |

#### 📌 Exemple

```
wfg config delete-context WFGEN_PROD
```

### `delete-server`

Supprime le serveur spécifié de la configuration.

#### **Utilisation**

```
wfg config delete-server [SERVER_NAME] --force
```

#### **Argument**

| Nom    | Type   | Description                | Comportement |
| ------ | ------ | -------------------------- | ------------ |
| `name` | Chaîne | Nom du serveur à supprimer | Requis       |

#### **Option**

| Alias             | Type    | Description                                                        | Valeur par défaut | Comportement |
| ----------------- | ------- | ------------------------------------------------------------------ | ----------------- | ------------ |
| `--force` ou `-f` | Booléen | Force la suppression du serveur et supprime les contextes associés | `false`           | Facultatif   |

#### 📌 Exemple

```
wfg config delete-server WFGEN_PROD_SERVER --force
```

### `delete-user`

Supprime l'utilisateur spécifié de la configuration.

#### **Utilisation**

```
wfg config delete-user [USER_NAME] --force
```

#### **Argument**

| Nom    | Type   | Description                      | Comportement |
| ------ | ------ | -------------------------------- | ------------ |
| `name` | Chaîne | Nom de l'utilisateur à supprimer | Requis       |

#### **Option**

| Alias             | Type    | Description                                                              | Valeur par défaut | Comportement |
| ----------------- | ------- | ------------------------------------------------------------------------ | ----------------- | ------------ |
| `--force` ou `-f` | Booléen | Force la suppression de l'utilisateur et supprime les contextes associés | `false`           | Facultatif   |

#### 📌 Exemple

```
wfg config delete-user ADMIN_PROD_ACCOUNT --force
```

### `get-contexts`

Décrit un ou plusieurs contextes.

#### Utilisation

```
wfg config get-contexts [CONTEXT_NAME1] [CONTEXT_NAME2] [CONTEXT_NAME3]
```

{% hint style="info" %}
`[CONTEXT_NAME]` représente le nom donné au contexte CLI qui contient vos informations de serveur et d'utilisateur.
{% endhint %}

#### **Argument**

| Nom     | Type   | Description                            | Comportement |
| ------- | ------ | -------------------------------------- | ------------ |
| `names` | Chaîne | Nom(s) du ou des contexte(s) à obtenir | Facultatif   |

#### 📌 Exemple

```
wfg config get-contexts WFGEN_PROD
```

### `get-servers`

Affiche les serveurs définis dans la configuration.

#### **Utilisation**

```
wfg config get-servers
```

### `get-users`

Affiche les utilisateurs définis dans la configuration.

#### **Utilisation**

```
wfg config get-users
```

### `rename-context`

Renomme un contexte dans la configuration.

#### **Utilisation**

```
wfg config rename-context [CONTEXT_OLD_NAME] [CONTEXT_NEW_NAME]
```

{% hint style="info" %}
`[CONTEXT_NAME]` représente le nom donné au contexte CLI qui contient vos informations de serveur et d'utilisateur.
{% endhint %}

#### **Arguments**

| Nom        | Type   | Description                | Comportement |
| ---------- | ------ | -------------------------- | ------------ |
| `old-name` | Chaîne | Nom du contexte à renommer | Requis       |
| `new-name` | Chaîne | Nouveau nom du contexte    | Requis       |

#### 📌 Exemple

```
wfg config rename-context WFGEN_PROD WFGEN_DEV
```

### `rename-server`

Renomme un serveur dans la configuration.

#### **Utilisation**

```
wfg config rename-server [SERVER_OLD_NAME] [SERVER_NEW_NAME]
```

#### **Arguments**

| Nom        | Type   | Description               | Comportement |
| ---------- | ------ | ------------------------- | ------------ |
| `old-name` | Chaîne | Nom du serveur à renommer | Requis       |
| `new-name` | Chaîne | Nouveau nom du serveur    | Requis       |

#### 📌 Exemple

```
wfg config rename-server WFGEN_PROD_SERVER WFGEN_DEV_SERVER
```

### `rename-user`

Renomme un utilisateur dans la configuration.

#### **Utilisation**

```
wfg config rename-user [USER_OLD_NAME] [USER_NEW_NAME]
```

#### **Arguments**

| Nom             | Type   | Description                  | Comportement |
| --------------- | ------ | ---------------------------- | ------------ |
| `USER_OLD_NAME` | Chaîne | Nom d'utilisateur à renommer | Requis       |
| `USER_NEW_NAME` | Chaîne | Nouveau nom d'utilisateur    | Requis       |

#### 📌 Exemple

```
wfg config rename-user ADMIN_PROD_ACCOUNT ADMIN_DEV_ACCOUNT
```

### `set-context`

Définit une entrée de contexte dans la configuration.

#### **Utilisation**

```
wfg config set-context [CONTEXT_NAME] --server [SERVER_NAME] --user [USER_NAME]
```

{% hint style="info" %}
`[CONTEXT_NAME]` représente le nom donné au contexte CLI qui contient vos informations de serveur et d'utilisateur.
{% endhint %}

#### **Argument**

| Nom    | Type   | Description     | Comportement |
| ------ | ------ | --------------- | ------------ |
| `name` | Chaîne | Nom du contexte | Requis       |

#### **Options**

| Alias              | Type   | Description       | Valeur par défaut | Comportement |
| ------------------ | ------ | ----------------- | ----------------- | ------------ |
| `--server` ou `-s` | Chaîne | Nom du serveur    | Aucune            | Requis       |
| `--user` ou `-u`   | Chaîne | Nom d'utilisateur | Aucune            | Requis       |

#### 📌 Exemple

```
wfg config set-context WFGEN_PROD --server WFGEN_PROD_SERVER --user ADMIN_PROD_ACCOUNT
```

### `set-server`

Définit une entrée de serveur dans la configuration.

#### Utilisation

```
wfg config set-server [SERVER_NAME] --url [URL] --version [SERVER_VERSION]
```

#### **Argument**

| Nom    | Type   | Description    | Comportement |
| ------ | ------ | -------------- | ------------ |
| `name` | Chaîne | Nom du serveur | Requis       |

#### **Options**

| Alias                | Type   | Description                            | Valeur par défaut | Comportement |
| -------------------- | ------ | -------------------------------------- | ----------------- | ------------ |
| `--url` ou `-u`      | Chaîne | URL WorkflowGen                        | Aucune            | Facultatif   |
| `--webforms` ou `-w` | Chaîne | Chemin des formulaires Web WorkflowGen | Aucune            | Facultatif   |
| `--version` ou `-v`  | Chaîne | Version de WorkflowGen                 | Aucune            | Facultatif   |

#### 📌 Exemple

```
wfg config set-server WFGEN_PROD_SERVER --url http://localhost:8080/wfgen/admin/ --version 7.22.0
```

### `set-user`

Définit une entrée utilisateur dans la configuration.

#### Utilisation

```
wfg config set-user [USER_NAME] --username [USER_USERNAME] --password [USER_PASSWORD]
```

#### **Argument**

| Nom    | Type   | Description       | Comportement |
| ------ | ------ | ----------------- | ------------ |
| `name` | Chaîne | Nom d'utilisateur | Requis       |

#### **Options**

| Alias                | Type   | Description                   | Valeur par défaut | Comportement |
| -------------------- | ------ | ----------------------------- | ----------------- | ------------ |
| `--username` ou `-u` | Chaîne | Nom d'utilisateur WorkflowGen | Aucune            | Requis       |
| `--password` ou `-w` | Chaîne | Mot de passe WorkflowGen      | Aucune            | Requis       |

#### 📌 Exemple

```
wfg config set-user ADMIN_PROD_ACCOUNT --username wfgen_admin --password QWRtaW4xMjMh
```

### `use-context`

Définit le contexte actuel dans la configuration.

#### Utilisation

```
wfg config use-context [CONTEXT_NAME]
```

{% hint style="info" %}
`[CONTEXT_NAME]` représente le nom donné au contexte CLI qui contient vos informations de serveur et d'utilisateur.
{% endhint %}

#### **Argument**

| Nom    | Type   | Description     | Comportement |
| ------ | ------ | --------------- | ------------ |
| `name` | Chaîne | Nom du contexte | Requis       |

#### 📌 Exemple

```
wfg config use-context WFGEN_PROD
```

## `project`

La commande `project` vous permet d'exporter ou d'importer un projet WorkflowGen entier à partir d'un manifeste.

{% hint style="info" %}
Disponible depuis la version 7.17.0 de WorkflowGen.
{% endhint %}

### `init`

La commande `init` vous permet de générer un fichier `manifest.json` de manière interactive.

#### Utilisation

```
wfg project init --path ProjectPath
```

#### Options

| Alias             | Type    | Description                                                | Valeur par défaut | Comportement |
| ----------------- | ------- | ---------------------------------------------------------- | ----------------- | ------------ |
| `--path` ou `-p`  | Chaîne  | Chemin du répertoire où le projet sera initialisé          | Répertoire actuel | Facultatif   |
| `--bare`          | Booléen | Générer un fichier `manifest.json` avec le contenu minimal | `false`           | Facultatif   |
| `--force` ou `-f` | Booléen | Forcer la génération du `manifest.json`                    | `false`           | Facultatif   |

#### 📌 Exemples

```
wfg project init --path ./MyProject
```

```
wfg project init --path ./MyProject --bare --force
```

### `export`

Exporte un projet de votre serveur WorkflowGen vers un référentiel local.

#### **Utilisation**

```
wfg project export --path [PROJECT_PATH]
```

#### **Option**

| Alias            | Type   | Description                                                                               | Valeur par défaut | Comportement |
| ---------------- | ------ | ----------------------------------------------------------------------------------------- | ----------------- | ------------ |
| `--path` ou `-p` | Chaîne | Chemin d'accès au dossier dans lequel se trouvent le manifeste et les fichiers du projet. | Répertoire actuel | Facultatif   |

#### 📌 Exemple

```
wfg project export --path ./MyProject
```

### `import`

Importe un projet d'un référentiel local vers votre serveur WorkflowGen.

#### **Utilisation**

```
wfg project import --source [PATH] --force
```

#### **Options**

| Alias              | Type    | Description                                                         | Valeur par défaut | Comportement |
| ------------------ | ------- | ------------------------------------------------------------------- | ----------------- | ------------ |
| `--source` ou `-s` | Chaîne  | Chemin du projet                                                    | Répertoire actuel | Facultatif   |
| `--force` ou `-f`  | Booléen | Met à jour les listes globales et applications existantes du projet | `false`           | Facultatif   |

#### 📌 Exemple

```
wfg project import --source C:\repository
```

### `show`

Affiche le contenu d'un lien de manifeste vers un projet.

#### Utilisation

```
wfg project show --path [PROJECT_PATH]
```

#### **Option**

| Alias            | Type   | Description      | Valeur par défaut | Comportement |
| ---------------- | ------ | ---------------- | ----------------- | ------------ |
| `--path` ou `-p` | Chaîne | Chemin du projet | Répertoire actuel | Facultatif   |

#### 📌 Exemple

```
wfg project show --path C:\repository
```

## `process`

La commande `process` vous permet d'exporter (`export`), d'importer (`import`), d'afficher (`get`), de mettre à jour (`update`) ou de supprimer (`delete`) un processus.

{% hint style="info" %}
Disponible depuis la version 7.17.0 de WorkflowGen.
{% endhint %}

### `export`

Exporte un processus spécifique de votre serveur WorkflowGen vers un référentiel local.

#### **Utilisation**

```
wfg process export [PROCESS_NAME] [PROCESS_VERSION] --destination [PATH]
```

#### **Arguments**

| Nom       | Type   | Description          | Comportement |
| --------- | ------ | -------------------- | ------------ |
| `name`    | Chaîne | Nom du processus     | Requis       |
| `version` | Int    | Version du processus | Requis       |

#### **Option**

| Alias                   | Type   | Description          | Valeur par défaut | Comportement |
| ----------------------- | ------ | -------------------- | ----------------- | ------------ |
| `--destination` ou `-d` | Chaîne | Chemin d'exportation | Répertoire actuel | Facultatif   |

#### 📌 Exemple

```
wfg process export SIMPLE_APPROVAL 1
```

### `import`

Importe un processus spécifique d'un référentiel local vers votre serveur WorkflowGen.

#### **Utilisation**

```
wfg process import [PROCESS_PATH] --useVersionNumber --state [STATE]
```

#### **Argument**

| Nom         | Type   | Description                        | Comportement |
| ----------- | ------ | ---------------------------------- | ------------ |
| `file-path` | Chaîne | Chemin du fichier XML de processus | Requis       |

#### Options

| Alias                  | Type    | Description                                                                                           | Valeur par défaut | Comportement |
| ---------------------- | ------- | ----------------------------------------------------------------------------------------------------- | ----------------- | ------------ |
| `--use-version-number` | Booléen | Utiliser la version de processus du fichier XML                                                       | `false`           | Facultatif   |
| `--state` ou `-s`      | Chaîne  | Spécifie avec quel statut le processus sera importé                                                   | `TEST`            | Facultatif   |
| `--folder`             | String  | Nom de destination du dossier de processus dans lequel importer le processus; le dossier doit exister | `DEFAULT`         | Facultatif   |

{% hint style="info" %}

#### **`UseVersionNumber`**

* `<use-version-number = true>` tentera d'ajouter le processus avec le numéro de version dans le fichier XML, s'il n'existe pas déjà.<br>
* `<use-version-number = false>` ajoutera le processus avec le dernier numéro de version plus un (p.ex. si la dernière version actuelle est `3`, définir ce paramètre sur `false` importera le processus en tant que version `4`).

#### **`state`**

L'état (`state`) peut être l'un des suivants :

* `TEST` (par défaut)
* `ACTIVE`
* `DEV`
* `ARCHIVE`
  {% endhint %}

#### 📌 Exemple

```
wfg process import C:\repository\SIMPLE_APPROVALv1.xml
```

### `get`

Affiche un ou plusieurs processus.

#### Utilisation

```
wfg process get [PROCESS_NAME] [PROCESS_VERSION]
```

#### **Arguments**

| Nom       | Type   | Description          | Comportement                             |
| --------- | ------ | -------------------- | ---------------------------------------- |
| `name`    | Chaîne | Nom du processus     | Facultatif                               |
| `version` | Int    | Version du processus | Facultatif (sauf si un nom est spécifié) |

#### 📌 Exemple

```
wfg process get SIMPLE_APPROVAL 1
```

### `update`

Met à jour les informations pour un seul processus.

#### **Utilisation**

```
wfg process update [PROCESS_NAME] [PROCESS_VERSION] -d [DESCRIPTION] -s [STATE]
```

#### **Arguments**

| Nom       | Type   | Description          | Comportement |
| --------- | ------ | -------------------- | ------------ |
| `name`    | Chaîne | Nom du processus     | Requis       |
| `version` | Int    | Version du processus | Requis       |

#### Options

| Alias                   | Type   | Description                                                        | Valeur par défaut | Comportement |
| ----------------------- | ------ | ------------------------------------------------------------------ | ----------------- | ------------ |
| `--description` ou `-d` | Chaîne | Spécifie la description avec laquelle le processus sera mis à jour | Aucune            | Facultatif   |
| `--state` ou `-s`       | Chaîne | Spécifie avec quel statut le processus sera mis à jour             | Aucune            | Facultatif   |

{% hint style="info" %}

#### **`state`**

L'état (`state`) peut être l'un des suivants :

* `TEST`
* `ACTIVE`
* `DEV`
* `ARCHIVE`
  {% endhint %}

#### 📌 Exemple

```
wfg process update SIMPLE_APPROVAL 1 -s DEV
```

### `delete`

Supprime un seul processus par nom et version.

#### **Utilisation**

```
wfg process delete [PROCESS_NAME] [PROCESS_VERSION]
```

#### Arguments

| Nom       | Type   | Description          | Comportement |
| --------- | ------ | -------------------- | ------------ |
| `name`    | Chaîne | Nom du processus     | Requis       |
| `version` | Int    | Version du processus | Requis       |

#### 📌 Exemple

```
wfg process delete SIMPLE_APPROVAL 1
```

## `global-list`

La commande `global-list` vous permet d'exporter (`export`), d'importer (`import`), d'afficher (`get`) ou de supprimer (`delete`) une liste globale.

{% hint style="info" %}
Disponible depuis la version 7.17.0 de WorkflowGen.
{% endhint %}

### `export`

Exporte une liste globale spécifique de votre serveur WorkflowGen vers un référentiel local.

#### **Utilisation**

```
wfg global-list export [GLOBAL_LIST_NAME] --destination [PATH]
```

#### **Argument**

| Nom    | Type   | Description             | Comportement |
| ------ | ------ | ----------------------- | ------------ |
| `name` | Chaîne | Nom de la liste globale | Requis       |

#### Option

| Alias                   | Type   | Description          | Valeur par défaut | Comportement |
| ----------------------- | ------ | -------------------- | ----------------- | ------------ |
| `--destination` ou `-d` | Chaîne | Chemin d'exportation | Répertoire actuel | Facultatif   |

#### 📌 Exemple

```
wfg global-list export Country
```

### `import`

Importe une liste globale spécifique de votre référentiel local vers votre serveur WorkflowGen.

{% hint style="warning" %}
**Problème connu (#3373) :** Voir les [notes de version WorkflowGen 7.22.2](https://discuss.workflowgen.com/t/workflowgen-7-22-2).
{% endhint %}

#### **Utilisation**

```
wfg global-list import [GLOBAL_LIST_PATH] --force
```

#### **Argument**

| Nom         | Type   | Description                                       | Comportement |
| ----------- | ------ | ------------------------------------------------- | ------------ |
| `file-path` | Chaîne | Le chemin vers le fichier XML de la liste globale | Requis       |

#### Option

| Alias             | Type    | Description                           | Valeur par défaut | Comportement |
| ----------------- | ------- | ------------------------------------- | ----------------- | ------------ |
| `--force` ou `-f` | Booléen | Met à jour la liste globale spécifiée | `false`           | Facultatif   |

#### 📌 Exemple

```
wfg global-list import C:\repository\Country
```

### `get`

Affiche une ou plusieurs listes globales.

#### **Utilisation**

```
wfg global-list get [GLOBAL_LIST_NAME]
```

#### **Arguments**

| Nom     | Type   | Description                             | Comportement |
| ------- | ------ | --------------------------------------- | ------------ |
| `names` | Chaîne | Nom(s) de la ou des liste(s) globale(s) | Facultatif   |

#### 📌 Exemple

```
wfg global-list get Country Clients
```

### `delete`

Supprime une seule liste globale par nom.

#### **Utilisation**

```
wfg global-list delete [GLOBAL_LIST_NAME]
```

#### **Arguments**

| Nom    | Type   | Description             | Comportement |
| ------ | ------ | ----------------------- | ------------ |
| `name` | Chaîne | Nom de la liste globale | Requis       |

#### 📌 Exemple

```
wfg global-list delete Country
```

## `application`

La commande `application` vous permet d'exporter (`export`), d'importer, d'afficher (`get`), d'afficher les paramètres (`get-parameters`) ou de supprimer (`delete`) une application.

{% hint style="info" %}
Disponible depuis la version 7.14.0 de WorkflowGen.
{% endhint %}

### `export`

Exporte une application spécifique de votre serveur WorkflowGen vers un référentiel local.

#### **Utilisation**

```
wfg application export [APPLICATION_NAME] --destination [PATH]
```

#### **Arguments**

| Nom    | Type   | Description          | Comportement |
| ------ | ------ | -------------------- | ------------ |
| `name` | Chaîne | Nom de l'application | Requis       |

#### Option

| Alias                   | Type   | Description          | Valeur par défaut | Comportement |
| ----------------------- | ------ | -------------------- | ----------------- | ------------ |
| `--destination` ou `-d` | Chaîne | Chemin d'exportation | Répertoire actuel | Facultatif   |

#### 📌 Exemple

```
wfg application export XMLTODATABASE
```

### `import`

Importe une application spécifique de votre référentiel local vers votre serveur WorkflowGen.

#### **Utilisation**

```
wfg application import [APPLICATION_PATH] --force
```

#### **Arguments**

| Nom         | Type   | Description                                                  | Comportement |
| ----------- | ------ | ------------------------------------------------------------ | ------------ |
| `file-path` | Chaîne | Le chemin complet contenant le fichier JSON de l'application | Requis       |

#### **Option**

| Alias             | Type    | Description                        | Valeur par défaut | Comportement |
| ----------------- | ------- | ---------------------------------- | ----------------- | ------------ |
| `--force` ou `-f` | Booléen | Met à jour l'application spécifiée | `false`           | Facultatif   |

#### 📌 Exemple

```
wfg application import C:\repository\XMLTODATABASE.xml
```

### `get`

Affiche une ou plusieurs applications.

#### **Utilisation**

```
wfg application get [APPLICATION_NAME]
```

#### **Arguments**

| Nom     | Type   | Description                        | Comportement |
| ------- | ------ | ---------------------------------- | ------------ |
| `names` | Chaîne | Nom(s) de la ou des application(s) | Facultatif   |

#### 📌 Exemple

```
wfg application get XMLTODATABASE
```

### `get-parameters`

Affiche les paramètres d'une application.

#### **Utilisation**

```
wfg application get-parameters [APPLICATION_NAME]
```

#### **Arguments**

| Nom    | Type   | Description          | Comportement |
| ------ | ------ | -------------------- | ------------ |
| `name` | Chaîne | Nom de l'application | Requis       |

#### 📌 Exemple

```
wfg application get-parameters XMLTODATABASE
```

### `delete`

Supprime une seule application par son nom.

#### **Utilisation**

```
wfg application delete [APPLICATION_NAME]
```

#### **Arguments**

| Nom    | Type   | Description          | Comportement |
| ------ | ------ | -------------------- | ------------ |
| `name` | Chaîne | Nom de l'application | Requis       |

#### 📌 Exemple

```
wfg application delete XMLTODATABASE
```

## `graphql`

La commande `graphql` vous permet d'exécuter une requête GraphQL personnalisée.

{% hint style="info" %}
Disponible depuis la version 7.0.0 de WorkflowGen.
{% endhint %}

#### Utilisation

```
wfg graphql [GRAPHQL_QUERY] -v [VARIABLE1_STRING] -V [VARIABLE2_INT] -V [VARIABLE3_BOOL]
```

```
wfg graphql [GRAPHQL_QUERY] --variableJson [VARIABLES_JSON]
```

#### Arguments

| Nom                      | Type   | Description                                                                                                                                                                                                           | Comportement    |
| ------------------------ | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------- |
| `--variable` ou `-v`     | Chaîne | Entre une variable qui sera lue sous forme de chaîne brute                                                                                                                                                            | Voir ci-dessous |
| `--variableCast` ou `-V` | Chaîne | Entre une variable que la CLI tentera de caster dans un type JSON valide                                                                                                                                              | Voir ci-dessous |
| `--variableJson`         | JSON   | <p>Entre un objet JSON contenant les noms des variables en tant que clés et les valeurs des variables en tant que valeurs de ces clés.</p><p></p><p>📌 <strong>Exemple :</strong> <code>{ "key": "value" }</code></p> | Voir ci-dessous |

{% hint style="warning" %}
Si la commande `graphql` utilise des variables, vous devez spécifier **soit** `--variable` et `--variableCast`, **soit** `--variableJson`. Vous ne pouvez pas utiliser `--variableJson` avec les deux autres arguments et vice-versa.
{% endhint %}

#### 📌 Exemples

{% tabs %}
{% tab title="PowerShell" %}

```bash
wfg graphql "query { viewer { userName } }"
```

{% endtab %}

{% tab title="Bash" %}

```bash
wfg graphql "query { viewer { userName } }"
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="PowerShell" %}

```bash
wfg graphql @'
query ($name: String!, $version: Int!) {
    process(name: $name, version: $version) {
        description
    }
}
'@ -v name=SIMPLE_APPROVAL -V version=1
```

{% endtab %}

{% tab title="Bash" %}

```bash
wfg graphql "$(cat <<QUERY
query (\$name: String!, \$version: Int!) {
        process(name: \$name, version: \$version) {
                description
        }
}
QUERY
)" -v name=SIMPLE_APPROVAL -V version=1
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="PowerShell" %}

```bash
wfg graphql @'
query ($name: String!, $version: Int!) {
    process(name: $name, version: $version) {
        description
    }
}
'@ --variableJson ((@{
    name = "SIMPLE_APPROVAL"
    version = 1
} | ConvertTo-Json -Compress) -replace '"', '\"')
```

{% hint style="warning" %}
En raison d'un bogue PowerShell connu au moment de l'écriture (<https://github.com/PowerShell/PowerShell/issues/1995>), les guillemets (`"`) seront supprimés de la chaîne lors de son envoi à un exécutable natif. La solution consiste à ajouter une barre oblique inverse (`\`) avant chaque guillemet ou à utiliser trois guillemets (`"""`).
{% endhint %}
{% endtab %}

{% tab title="Bash" %}

```bash
wfg graphql "$(cat <<QUERY
query (\$name: String!, \$version: Int!) {
    process(name: \$name, version: \$version) {
        description
    }
}
QUERY
)" --variableJson "$(cat <<JSON
{
    "name": "SIMPLE_APPROVAL",
    "version": 1
}
JSON
)"
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.workflowgen.com/cli-fr/1.0.0/liste-de-commandes.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
