Skip to content

Commit

Permalink
V1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
bhagyas committed Oct 24, 2018
1 parent 438e36b commit 33a5634
Show file tree
Hide file tree
Showing 5 changed files with 169 additions and 8 deletions.
78 changes: 78 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Created by .ignore support plugin (hsz.mobi)
### Node template
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# parcel-bundler cache (https://parceljs.org/)
.cache

# next.js build output
.next

# nuxt.js build output
.nuxt

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless

bin
md-gen.sh
34 changes: 32 additions & 2 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ Interact with the Alfresco repository with an interactive command line.
- Alfresco Developers and Architects

== Installation

=== From NPM
- Run `npm install -g alfresco-cli`

=== From GitHub
- Clone the repository
- Install using `npm install -g && npm link`

Expand All @@ -23,7 +28,11 @@ Use `cd <nodeId>`, where nodeId is the node ID of the nodeRef you want to change

=== Listing contents (chldren) within a node

Use `ls` or `ls <nodeId>` to list contents within a node.
Use `ls` or `ls <nodeId>` to list contents within a node.

=== Uploading files

Use `upload <filePath> [destinationNodeId]` to upload new files to Alfresco.

=== Search for contents

Expand All @@ -39,15 +48,36 @@ Use `search <query> [language]` to search for contents.
- Download files [TBD]
- View Metadata

=== Aliases Reference

You can use the following aliases within commands.


- `.` - current folder/content
- `..` - parent folder/content

== License
MIT License

== Author
- Bhagya Nirmaan Silva (about.me/bhagyas)

== Development Sponsors
- http://loftux.com[Loftux AB]

== Privacy Policy

There are no analytics gathered upon the use of the tool. However, the author reserves the right to add analytics on a later release to improve features provided by the tool.

== Contributors
None
None

== Version History

* 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` commands.
- Added support for `.` and `..` aliases.
* 1.0 - 20181023
- Initial release
54 changes: 54 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@

## Installation

### From NPM

- Run `npm install -g alfresco-cli`

### From GitHub

- Clone the repository

- Install using `npm install -g && npm link`
Expand All @@ -16,6 +22,26 @@

- 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.

### Changing into a node

Use `cd <nodeId>`, where nodeId is the node ID of the nodeRef you want to change to.

### Listing contents (chldren) within a node

Use `ls` or `ls <nodeId>` to list contents within a node.

### Uploading files

Use `upload <filePath> [destinationNodeId]` to upload new files to Alfresco.

### Search for contents

Use `search <query> [language]` to search for contents.

### Commands and Operations

- Login
Expand All @@ -32,6 +58,14 @@

- View Metadata

### Aliases Reference

You can use the following aliases within commands.

- `.` - current folder/content

- `..` - parent folder/content

## License

MIT License
Expand All @@ -40,10 +74,30 @@ MIT License

- Bhagya Nirmaan Silva (about.me/bhagyas)

## Development Sponsors

- [Loftux AB](http://loftux.com)

## Privacy Policy

There are no analytics gathered upon the use of the tool. However, the author reserves the right to add analytics on a later release to improve features provided by the tool.

## Contributors

None

## Version History

- 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` commands.

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

- 1.0 - 20181023

- Initial release
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"name": "alfresco-cli",
"version": "1.0.5",
"version": "1.1.0",
"description": "Alfresco CLI - Command line interface for Alfresco",
"main": "src/index.js",
"bin": "dist/bundle.js",
"scripts": {
"build": "webpack",
"start": "npm run build && node dist/bundle.js",
"test": "echo \"Error: no test specified\" && exit 1",
"prepublishOnly": "npm run build",
"prepublishOnly": "npm run build && sh md-gen.sh",
"postinstall": "npm run build"
},
"author": "Bhagya Nirmaan Silva",
Expand Down
7 changes: 3 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ vorpal.command('list parents [nodeRef]', 'Lists parents for a given nodeRef.')
);

vorpal
.command('upload-file <destinationNodeRef> <filePath> [relativePath] [autoRename]', 'Uploads a file to the given destination.')
.command('upload <filePath> <destinationNodeRef> [relativePath] [autoRename]', 'Uploads a file to the given destination.')
.option('-arn', "--autoRename", "Automatically rename the file if a similarly named file exists.")
.action(function (args, callback) {
let ongoing = false;
Expand Down Expand Up @@ -381,12 +381,11 @@ async function getParent(nodeRef){
return await alfrescoJsApi.core.childAssociationsApi.listParents(_nodeRef)
.then(function(data) {
vorpal.log('API called successfully. ' + data.list.pagination.totalItems + ' parent(s) found.');
vorpal.log(JSON.stringify(data));
let element = data.list.entries[0].entry;
vorpal.log(element.id);
return element.id;
}).catch(data => {
vorpal.log(data);
throw new Error("Unable to find parent.")
});
}

Expand Down Expand Up @@ -492,7 +491,7 @@ async function getNodeRef(nodeRef: string) {
}
}).catch( ()=> {
return alfrescoJsApi.nodes.getNodeInfo(nodeRef).then(function (data) {
vorpal.log('This is the name' + data.name );
vorpal.log('name: ' + data.name );
return nodeRef;
}, function (error) {
vorpal.log('This node does not exist');
Expand Down

0 comments on commit 33a5634

Please sign in to comment.