Skip to content

Commit

Permalink
v1.2.1 release
Browse files Browse the repository at this point in the history
  • Loading branch information
bhagyas committed Oct 25, 2018
1 parent 3bbe3a0 commit 51cc2ea
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 7 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -135,4 +135,6 @@ typings/
.serverless


.idea
.idea
bin
dist
12 changes: 11 additions & 1 deletion README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,17 @@ Interact with the Alfresco repository with an interactive command line.
- Clone the repository
- Install using `npm install -g && npm link`

== Features
- Performs Alfresco operations from the terminal.
- Autocompletes node names for valid operations.
- Maintains a session with a valid token, automatically persists within terminal sessions.
- Maintains a local command history


== Usage
- Call `alfresco-cli` from your terminal.


=== Logging in

Type `login --help` to read the help on logging in to the system and fetch an authentication token for the CLI.
Expand Down Expand Up @@ -74,14 +82,16 @@ None

== Version History

* 1.2.1 - 20181025
- Added `list versions` command.
* 1.2 - 20181025
- [MAJOR] Adding folder name auto completion
- Added `delete` command with support for deleting child nodes.

* 1.1 - 20181024
- Converted the code to Typescript
- Added support for node name as an alias for nodeId when referred from a valid context.
- Added `create user`, `create site`, `cd-site` commands.
- Added `create user`, `create site`, `cd-site`, `search` commands.
- Added support for `.` and `..` aliases.

* 1.0 - 20181023
Expand Down
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@

- Install using `npm install -g && npm link`

## Features

- Performs Alfresco operations from the terminal.

- Autocompletes node names for valid operations.

- Maintains a session with a valid token, automatically persists within terminal sessions.

- Maintains a local command history

## Usage

- Call `alfresco-cli` from your terminal.
Expand Down Expand Up @@ -100,7 +110,7 @@ None

- Added support for node name as an alias for nodeId when referred from a valid context.

- Added `create user`, `create site`, `cd-site` commands.
- Added `create user`, `create site`, `cd-site`, `search` commands.

- Added support for `.` and `..` aliases.

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "alfresco-cli",
"version": "1.2.0",
"version": "1.2.1",
"description": "Alfresco CLI - Command line interface for Alfresco",
"main": "src/index.js",
"bin": "dist/bundle.js",
Expand Down
20 changes: 17 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ vorpal


vorpal.command('change site <siteName>', 'Change into a site.')
.alias('cd-site')
.action((args, callback) => {
alfrescoJsApi.core.sitesApi.getSites().then(function (data) {
vorpal.log('API called successfully. Returned data for ' + data.list.entries.length + ' sites');
Expand Down Expand Up @@ -258,7 +259,7 @@ vorpal.command('view-metadata [nodeRef] [property]', "Shows metadata for the sel
callback();
});

vorpal.command('move-node <nodeRef> <destinationNodeRef>', "Moves a node to a destination.")
vorpal.command('move <nodeRef> <destinationNodeRef>', "Moves a node to a destination.")
.autocomplete({data: nodeNameAutoCompletion})
.action(function (args, callback) {
alfrescoJsApi.nodes.moveNode(args[0])
Expand Down Expand Up @@ -293,7 +294,6 @@ vorpal.command('create site <siteId> [title] [description]', "Creates a site (Vi

vorpal.command("create person <userName> <password> [email] [firstName] [lastName]", "Creates a new user.")
.action((args, callback) => {
//alfresco JS API has no endpoint that can serve this request.
let self = this;
var person: PersonBodyCreate = {
id: args.userName,
Expand All @@ -315,6 +315,20 @@ vorpal.command("create person <userName> <password> [email] [firstName] [lastNam
callback();
});

vorpal.command('list versions <nodeRef>')
.action((args, callback) => {
getNodeRef(args.nodeRef).then(nodeId => {
alfrescoJsApi.core.versionsApi.listVersionHistory(nodeId, {}).then(function(data) {
printNodeList(data.list.entries);
callback();
}, function(error) {
console.error(error);
callback();
})
})
});


vorpal.command("create folder <folderName> <destinationNodeRef> [path]", "Create folder at the destination.")
.option('-p', "--path", "Relative path from the destination nodeRef.")
.alias('mkdir')
Expand Down Expand Up @@ -379,7 +393,7 @@ vorpal.command('search <query> [language]', "Searches the repostitory for conten

function printNodeList(entries) {
var table = new AsciiTable();
table.setHeading('nodeId', 'name', "type");
table.setHeading('id', 'name', "type");
entries.forEach(item => {
table.addRow(item.entry.id, item.entry.name, item.entry.nodeType);
});
Expand Down

0 comments on commit 51cc2ea

Please sign in to comment.