Unleash awesomeness. Private packages, team management tools, and powerful integrations. Get started with npm Orgs »

@cables/cables

0.2.0 • Public • Published

cables-cli

Tool to export and download cables patches from the command line

             C   A   B   L   E   S   >>>  ___:_ _
       _ _:_______________ _____________ /   |\   _ _______
          |  _           /\\_           \    |\\.  _)     /\       ______         
    _____ | (/)        _/\\\(_______    /    |\\| /    __/\\\     /     /\    
   /   _/\_      _    /_\\\/_\\\\ _/   /     |\\|/     \_\\\/___ /     /\\\ 
  /   /_\\|_     |\     \\(    /\ \   /_    _:\\/__ /\_/       /_\   _/_\\/___
_/   /(     \    |_\     \__  /_\\_)    \         (_          /   \          /\
\           _\   \___     _/             \         /         /     \_       /\\\
 \_________(    _|\\\\     \_ ___________/   _    /_________/       /      /\\\/
  \\\\\\\\|_____)\\\        |\\\\\/         (/)  /\\\\\\\/                /_\\/
   \\\\\\\\\\\\\\\\\\_______:\\.\/______________/\\\\\\\\\_________________(\\ 
 _|.._     \\\\\\\)  \\\\\\\\\\| \\\\\\\\\\\\\\\\\\\/     \\\\\\\\\\\\\\\\\\\\
(_|||_)               \\\\\\\\\|  \\\\\\\\\\\\\\\\\/       \\\\\\\\\\\\\\\\\\( 
 ---|-->> 

Installation

Run npm install -g @cables/cables.
Create an API key on cables.gl/settings —> navigate to API key —> press Generate. When you first start the tool it will show a prompt for the API key. Once entered your API key will be stored in ~/.cablesrc.

Run

To export and download a cables patch into a specific directory run:

cables -e [CABLES PATCH ID] -d [DESTINATION]

You can find the patch ID by opening your patch in the cables editor – the last part of the URL is the patch ID, e.g.:

https://cables.gl/ui/#/project/5a7daa8b285c9aca0982bba2
> 5a7daa8b285c9aca0982bba2 is the patch ID

Example:

cables -e 5a7daa8b285c9aca0982bba2 -d 'my-patch'

Please note: Running the command will overwrite everything in the my-patch-folder.

Arguments

  • -e / --export [PATCH ID]: Export patch
  • -d / --destination [DESTINATION]: Folder to download the patch to, can either be absolute or relative
  • -i / --no-index : Removes the index.html file when set
  • -j / --json-filename [JSON FILENAME] : Define the filename of the patch json file

Use as a module

Install as dependency:

npm install --save @cables/cables

Export:

cables.export(options, onFinished, onError);

Simple Example:

var cables = require('@cables/cables');
 
cables.export({
  patchId: '5a4ea356429259dd579a0fea',
  destination: 'patch' 
}, onFinished, onError);
 
function onFinished() {
  console.log('Export finished!');
}
 
function onError(err) {
  console.log('There was an error exporting your patch :/');
}

Advanced Example:

var cables = require('@cables/cables');
 
cables.export({
  patchId: '5a4ea356429259dd579a0fea',
  destination: 'patch',
  noIndex: true,
  jsonFilename: 'my-patch' /* patch will be stored as my-patch.json */
}, onFinished, onError);
 
function onFinished() {
  console.log('Export finished!');
}
 
function onError(err) {
  console.log('There was an error exporting your patch :/');
}

Further Infos

For more infos on the cables API see cables API docs.

install

npm i @cables/cables

Downloadsweekly downloads

2

version

0.2.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability