# wp package



Aide:

```bash
$ wp help package
```

```bash
NAME

  wp package

DESCRIPTION

  Lists, installs, and removes WP-CLI packages.

SYNOPSIS

  wp package <command>

SUBCOMMANDS

  browse         Browses WP-CLI packages available for installation.
  install        Installs a WP-CLI package.
  list           Lists installed WP-CLI packages.
  path           Gets the path to an installed WP-CLI package, or the package directory.
  uninstall      Uninstalls a WP-CLI package.
  update         Updates all installed WP-CLI packages to their latest version.
```

Liste des packages installés:

```bash
$ wp package list
+---------------------------+-------------+------------+--------+----------------+
| name                      | authors     | version    | update | update_version |
+---------------------------+-------------+------------+--------+----------------+
| trepmal/wp-revisions-cli  |             | dev-master | none   |                |
| wp-cli/wp-super-cache-cli | WP-CLI Team | dev-master | none   |                |
+---------------------------+-------------+------------+--------+----------------+
```

Installer un package:  
```bash
$ wp package install wp-cli/wp-super-cache-cli
Installing package wp-cli/wp-super-cache-cli (dev-master)
Updating /Users/bruno/.wp-cli/packages/composer.json to require the package...

## Using Composer to install the package...

Loading composer repositories with package information
Updating dependencies
Resolving dependencies through SAT
Looking at all rules.

Dependency resolution completed in 0.221 seconds
Analyzed 1299 packages to resolve dependencies
Analyzed 24098 rules to resolve dependencies
Package operations: 1 install, 0 updates, 0 removals
Installs: wp-cli/wp-super-cache-cli:dev-master 4993755

- Installing wp-cli/wp-super-cache-cli (dev-master 4993755)
  Writing lock file
  Generating autoload files

------

Success: Package installed.
```

Tester si un package est installé:

```bash
# !/bin/bash

packages_list=$(wp package list | sed -n '1!p' | awk '{print $1'})

# Si le package /wp-cli/admin-command est installé
if [ -n "$(echo "$packages_list" | awk '$1 ~ /wp-cli\/admin-command/')" ]; then
    echo "/wp-cli/admin-command est installé"
fi
```

