Request for a new contrib repository for XWiki CLI

Hello everyone,

Would it be possible to create a cli contrib repository?

XWiki-cli is / would be a (set of) tool(s) written in Java to manipulate XWiki from the command line. The current prototype allows editing content and properties on a XWiki instance as well as in a maven repository of XML documents (XAR), at the same time or not, through various ways (command lines, call to a code editor or an IDE…)

Here an output of its --help command for a preview of the things it would do:

xwiki-cli JAVA

Actions:
    --help                   Show the help
    --edit-page              Edit a complete XWiki document
    --get-content            Get the content of a XWiki document
    --set-content CONTENT    Set the content of a XWiki document
    --edit-content           Edit the content of a XWiki document with a text editor
    --get-title              Get the title of a XWiki document
    --set-title TITLE        Set the title of a XWiki document
    --list-properties        List the document's properties,
                             optionally from the given object
    --list-objects           List the document's objects,
                             optionally from the given class
    --edit-content PROPERTY  Edit the content of a given property with a text editor
    --get-property PROPERTY  Get the value of the given property,
                             optionally from the given object
    --set-property PROPERTY  Set the value of the given property,
                             optionally from the given object (see -v to give a value)
    --mount PATH             Mount a FUSE filesystem with the wiki contents at PATH

Parameters:
    --debug                  Enable debug mode (for now, more verbose logs)
    --print-xml              Print received XML code (for debugging)
    -b HOST[:PORT][/CONTEXT] Use this host and port (and this context) to connect to XWiki. See also -u.
    --editor EDITOR          Use this editor (necessary if environnement variable EDITOR is not set)
    -p PAGE                  Specify the page (dotted notation). See also -u.
    -u, --url URL            Specify the page's URL
    -w WIKI                  Specify the wiki
    --wiki-readonly          Don't write on the wiki
    --wiki-writeonly         Don't read from the wiki.
                             Note that in this case you need to use an other source,
                             generally the XML dir.
    -o CLASS[/NUMBER]        Specify the class and optionally the number of the object to consider
    -v VALUE                 The value to use
    --read-from-xml FILE     Read the document from the given file
    --write-to-xml FILE      Write the document to the given file
    --xml-file FILE          Same as --write-to-xml FILE --read-from-xml FILE
    --read-from-xml-dir DIR  Same as --read-from-xml but for a full wiki directory
    --write-to-xml-dir DIR   Same as --write-to-xml but for a full wiki directory
    --xml-dir DIR            Same as --read-from-xml-dir DIR --write-to-xml-dir DIR
    -H 'Header-Name: Val'  Add a custom HTTP header (repeat to have several ones)

Authentication:
    --user USENAME
        The XWiki username to use.
    --pass PASS
        The XWiki user’s password.
1 Like

Hi,

This kind of tool : I think it could be very useful.

The cli commands can be used into scripts.
=> create some batch task, …

You have an example of this kind of tool in JBoss and WildFly.
The JBoss Cli tool is… really very useful.

It is a good alternative to the graphical interface, to administrate the JBoss or WildFly instances.
Both for direct use, with nothing more than an admin shell console (remote or on the local computer/server).
Or for use in scripts, to make some big admin tasks, reusable, launched several times (each day, each mounth, etc…)

See the examples about it, on internet (documentation, tutorials, etc…).

Feel free to ask if questions,

Antoine

1 Like

Indeed! Thanks for your comment.

We actually already have a working tool (prototype but working), I’m waiting for the repository to share it :slight_smile:

Thumbs up for developing that! Looking forward to using it as it will significantly ease my work as well :slight_smile:

Just created and configured GitHub - xwiki-contrib/cli: A (set of) tool(s) written in Java to manipulate XWiki from the command line and Loading....

Nice, thanks! :slight_smile: