enonic / cli-enonic

GNU General Public License v3.0
41 stars 2 forks source link

Enonic XP CLI - Toolbox #1

Closed GlennRicaud closed 6 years ago

GlennRicaud commented 6 years ago

The full description of the project is defined here: https://github.com/enonic/enonic/blob/master/xp/7.0/enonic-cli.md

Note: In the future, this will do a lot of different tasks than sending requests (git clone, gradle tasks, downloading/unziping/launching xp distros, ...)

The expected behaviour when this epic is finished is the following:

> ./enonic
Usage: enonic <group | command>

Groups:
  snapshot Manage snapshots
  dump Manage dumps
  export Manage exports
  repo Manage exports
  app Manage applications
  cms Manage contents
Commands:
  vacuum Vacuum blob

Run 'enonic <group | command> --help' for more information on a command.
> ./enonic snapshot
Usage: enonic snapshot <group | command>

Commands:
  ls Returns a list of existing snapshots with name and status.
  new Stores a snapshot of the current state of the repository.
  restore Restores a snapshot of a previous state of the repository.
  delete Deletes snapshots, either before a given timestamp or by name.
> ./enonic snapshot ls
Required option '-a' is missing
> ./enonic snapshot ls --help
Usage: enonic snapshot ls [options]

Options:
  -a <auth> Authentication token for basic authentication (user:password).
  -h <host> Host name for server (default is localhost).
  -p <port> Port number for server (default is 8080).
  --scheme <scheme> Scheme (default is http).
> ./enonic snapshot ls -a su:password
{
  "results" : [ {
    "indices" : [ "search-cms-repo", "search-system-repo", "storage-system-repo", "search-aa", "storage-aa", "storage-cms-repo" ],
    "name" : "2018-10-12t07-32-11.153z",
    "reason" : null,
    "state" : "SUCCESS",
    "timestamp" : "2018-10-12T07:32:11.251Z"
  }, {
    "indices" : [ "search-cms-repo", "search-system-repo", "storage-system-repo", "search-aa", "storage-aa", "storage-cms-repo" ],
    "name" : "2018-10-12t07-32-25.326z",
    "reason" : null,
    "state" : "SUCCESS",
    "timestamp" : "2018-10-12T07:32:25.404Z"
  } ]
}
sigdestad commented 6 years ago

Do we need a default host, port and scheme? I think we might change this?

pmi commented 6 years ago

@sigdestad Without having defaults you will have to specify them every time as command parameters. And as long as cli will probably be mostly used by developers and admins, localhost sounds like a quite reasonable guess.

pmi commented 6 years ago

Here's the current version with all the snapshot commands xp-cli.zip