Command Line Interface
Version added 2018-03-07 22:24:00| Modified 12-Apr-2018
The Command Line Interface (CLI) provides a collection of commands used for creating, packaging, installing, and launching the web app in the command line environment. The CLI allows you to develop and test app without having to use a specific IDE.
Download
-
Windows: webos-ose-cli-rpi_sdk-win.zip (37.29 MB)
-
Linux: webos-ose-cli-rpi_sdk-linux.tgz (37.15 MB)
-
Mac OS: webos-ose-cli-rpi_sdk-mac.tgz (25.86 MB)
Installation
Unzipping the Package
Unzip the downloaded CLI package. After unzipping the package, you can execute the CLI commands located in the following directories.
-
Windows: ares-cli/node_modules/ares-webos-sdk/bin
-
Linux & Mac OS: ares-cli/bin
Due to recursively nested directory structure of Node.js modules used by CLI, the resulting path length may exceed the maximum path length of Windows. To prevent issues while installing and using CLI, we strongly recommend that you do the following:
-
To unzip the package, use a program that supports file pathnames longer than 260 characters, such as 7-Zip.
-
Unzip the package under the root directory (for example, C:\ or D:\).
To make it easy to execute CLI commands, you need to add the CLI directory to PATH environment variable.
Set Directory - Windows
If you unzipped the package under C:\, the CLI commands would be located in C:\ares-cli. You need to add the directory to the environment variable.
You can create a system variable pointing to the directory and add the system variable to the PATH.
C:\> setx /m WEBOS_CLI_HOME "C:\ares-cli"
C:\> setx /m PATH "%WEBOS_CLI_HOME%;%PATH%"
Otherwise, you can add the directory to the PATH directly.
C:\> setx /m PATH "C:\ares-cli; %PATH%"
To set the PATH for current user only, remove "/m" from the commands above.
To make the changes take effect, you must restart the command prompt.
Set Directory - Linux & Mac OS
There are many ways to set the environment variable in Linux and Mac OS. Here, we describe the method to add the information to the .profile so that the PATH is automatically configured each time the shell is executed. We will assume that the CLI has been unzipped under the home directory.
First, open the .profile which is located in the home directory. If the file does not exist, the command will create one.
$ vi ~/.profile
Add the lines below at the end of the file.
...
# add CLI path
if [ -d "$HOME/ares-cli/bin" ]; then
export PATH="$PATH:$HOME/ares-cli/bin"
fi
To make the changes take effect, you must execute the following command or restart the shell .
$ source ~/.profile
Command Usage
With the CLI, you can install your app on the target device. You can also retrieve, run, terminate, and remove the apps that are installed on the platform of webOS Open Source Edition.
The CLI can be used during any of the following stages of the development process:
The following shows the commands you could use:
Commands |
Descriptions |
---|---|
ares |
Provides the help menu for using the ares commands. |
Creates a web app from a template. |
|
Creates an app package file. |
|
Manages the target devices. |
|
Installs an app on the target device. |
|
Runs or terminates the web app. |
|
Runs the Web Inspector or Node Inspector for debugging web app or JS service. |
|
Runs the Web server for testing local app file. |
|
Executes shell commands in the target device. |
|
Pushes file(s) from a host machine to a target device. |
|
Pulls file(s) from a target device to a host machine. |
-
Open All
-
- ares-generate
- ares-package
- ares-setup-device
- ares-install
- ares-launch
- ares-inspect
-
This command provides Web Inspector and Node Inspector. Web Inspector and Node Inspector run in a web browser on the host machine. Each inspector displays the run-time information of the web application and JS services, respectively.
Usages
ares-inspect [OPTION...] [--app|-a] APP_ID
ares-inspect [OPTION...] --service|-s SERVICE_ID
ares-inspect --version|-V
ares-inspect --help|-h
Options
Option
Parameter
Description
-d, --device
TARGET_DEVICE
Specifies the target device where the application is installed.
-a, --app
APP_ID
Specifies the application to run with Web Inspector.
-s, --service
SERVICE_ID
Specifies the JS service to run with Node Inspector.
-o, --open
None
Opens the default browser of the host machine.
Web Inspector and Node Inspector work in the Blink-based web browsers (e.g. Chrome or Opera) only. You have to re-open the inspector page in one of those browsers if another browser is your default web browser (e.g. Safari or Internet Explorer).
-v
None
Displays the execution log.
-V, --version
None
Displays the version of the ares-inspect command.
-h, --help
None
Displays the help of the ares-inspect command.
Parameters
Parameter
Description
APP_ID
ID of the application whose information is to be viewed using the Web Inspector.
SERVICE_ID
ID of the JS Service whose information is to be viewed using the Node Inspector.
TARGET_DEVICE
Specifies the target device on which the application is installed.
Examples
Here are some examples of the different uses:
Running the Web Inspector for an application
ares-inspect --device target --app com.example.sampleapp
Running the Node Inspector for a JS service
ares-inspect --device target --service com.example.sampleapp.sampleservice
- ares-server
- ares-shell
- ares-push
- ares-pull