Command Line Interface

The CLI (Command Line Interface) 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.

Features of CLI

With the CLI, you can install your app on the emulator. You can also retrieve, run, terminate, and remove the apps that are installed on the webOS TV. 

The CLI can be used during any of the following stages of the development process:

Development_Process_with_CLI_-_No_Dev_Mode.png

The following shows the commands you could use:

Command

Description

ares Provides the help menu for using the ares commands

ares-generate

Creates a web app from a template.

ares-package

Creates an app package file.

ares-setup-device

Manages the target devices.

ares-install

Installs an app on the target device.

ares-launch

Runs or terminates the web app.

ares-inspect

Runs the Web Inspector for web app debugging.

ares-server

Runs the Web server for testing local app file.

ares-novacom

Gets private key from webOS TV for Developer Mode App.

Usages and Options

This section describes the usages of CLI commands and options.

Open All


ares-generate

This command creates an app from a template. ares-generate displays a list of available templates for web app, JS Service and webOS config file (appinfo.json) creation.

Usages

ares-generate [OPTION...] APP_DIR|SERVICE_DIR

ares-generate --list|-l

ares-generate --init|-i APP_DIR

ares-generate --version

ares-generate --help|-h

Options

Option

Parameter

Description

-t, --template

TEMPLATE

Uses the specified template

-p, --property

PROPERTY

Saves the application information that are entered.

-s, --servicename

SERVICE_NAME

Specifies the JS Service ID.

-f, --overwrite

None

Allows overwriting of existing files.

-l, --list

None

Lists templates of each template types.

-i, --init APP_DIR

Initialize Enyo libraries in your Enyo app directory with .enyoconfig file.  The .enyoconfig file holds the repository, target version, and library location information of Enyo libraries used in your Enyo app. By modifying .enyoconfig file, you can easily change the Enyo libraries used in your app.

The .enyoconfig file only exists in Enyo templates. Therefore, this option is only available for Enyo apps. For more information about .enyoconfig file, visit Enyo Developer Tools.

-v

None

Displays the execution log.

-V, --version

None

Displays the version of ares-generate command.

-h, --help

None

Displays the help of ares-generate command

The ares-generate requires the git command. You should install git before using the ares-generate. 

Parameters

Parameter

Description

APP_DIR

Specifies the app project directory. If the directory does not exist, the directory will be created while executing the command.

SERVICE_DIR

Specifies the service directory. If the specified directory does not exist, the directory will be created while executing the command.

PROPERTY

Specifies the app information. It is entered using JSON-type strings in the format of "Key=Value" or "{'key1':'value1', 'key2':'value2', ...}".

TEMPLATE

Specifies the template to use when creating a project. The default value is moonstone-2017.

SERVICE_NAME

ID of the service you are creating. The service ID should be a sub-domain of the ID of the app which the service belongs to.

The following table shows the supported Enyo framework version for each webOS TV version.

webOS TV version

Supported Enyo framework versions

3.5 2.3.0, 2.5.4, 2.6.3, 2.6.4

3.0

2.3.0, 2.5.4, 2.6.3

2.0

2.3.0, 2.5.0

1.3 / 1.2

2.3.0

If you want to deploy your app on any available versions of the webOS TV, use moonstone-2014 template (Enyo version 2.3.0).

Examples

Here are some examples of the CLI usage:

Listing the bootplate (web application templates)

ares-generate -l

 

Creating a Moonstone web application with the default template in ./sampleApp directory

ares-generate sampleApp

 

Creating a Moonstone web application with custom App ID in ./sampleApp directory

ares-generate -p "id=com.example.sampleapp" sampleApp

 

Creating a JS Service with custom Service ID in ./sampleService directory

ares-generate -t js_service -s com.example.sampleapp.sampleservice sampleService

The service ID should be a sub-domain of the ID of the app which the service belongs to.

 

Creating a web app in the ./sampleApp and setting properties with JSON string

ares-generate -p "{'id':'com.example.sampleapp', 'version':'0.0.1', 'icon':'icon.png', 'type':'web', 'title':'Sample App', 'main':'index'}" sampleApp

 

Initialize Enyo libraries

ares-generate -i sampleApp


ares-package

This command packages the app and JS Service into a package file (.ipk) which is stored in a specified directory.

The packaging process has two phases: minifying the source code and creating a package file. ares-package command reduces the size of the source code by getting rid of as much redundant code as possible and merges it when creating a package file. ares-package command adjusts and shrinks the variable names and line spacing. (Only for Enyo app) It also merges multiple files into a single file in order to reduce the source code size and file load time.

ares-package command includes simple building function based on Enyo Framework. For Enyo Framework 2.6, we provide Enyo Developer Tools to enable you to build your app with various convenient options. You can build your app with appropriate option of Enyo Development Tools, and then packing your app with ares-package command. For more information, refer to below URL.

Usages

ares-package [OPTION...] APP_DIR [SERVICE_DIR] [PKG_DIR]

ares-package --version

ares-package -help|-h

Options

Option

Parameter

Description

-o, --outdir

OUT_DIR

Specifies a directory where the package file is created.

-c, --check

None

Checks whether the application's appinfo.json file exists or not. This option does not make package file. If appinfo.json file does not exist, warning messages appear.

-e, --app-exclude

EX_DIR

Lists the directories to exclude in the package file.

-n, --no-minify

None

Skips the process of minifying the source code.

-r, --rom

None

Proceeds up to the stage just before creating package file phase.

-v

None

Displays the execution log.

-V, --version

None

Displays the version of ares-package command.

-h, --help

None

Displays the help of ares-package command.

Parameters

Parameter

Description

APP_DIR

Specifies the directory of the application to be packaged.

SERVICE_DIR

Specifies the directory where JS Service's package.json file is located.

PKG_DIR

Specifies the directory where packageinfo.json file existed. The packageinfo.json file is a metadata file that contains information used by the packaging tool ares-package and the system. In general, you do not need to create packageinfo.json unless you are including JavaScript services with your application package. If there is no specified PKG_DIR, ares-package command makes packageinfo.json file from appinfo.json file.

If you use your own packageinfo.json file, keep the data rule, such as ID naming conventions in appinfo.json file.

OUT_DIR

Specifies the directory where the package file is to be created. If the directory is not entered, the package file is created in the same directory as the command.

EX_DIR

Specifies the name of directories and files to exclude from the application when packaging the package file. Directories used for samples and tests should be entered. All subdirectories and files in the specified directory are excluded. And also specified files are excluded. Command finds directories and file recursively from the application directory which are matched. To exclude multiple directories, enter as "-e subdir -e filename”. And you can use common pattern expression such as wildcard (*).

ares-package recognizes SERVICE_DIR and PKG_DIR automatically by configuration file. There is no order between the SERVICE_DIR and PKG_DIR.

Examples

Here are some examples of the different uses:

Creating a package file from ./sampleApp directory and outputting it in the working directory

ares-package sampleApp

 

Creating a package file from the ./sampleApp directory and outputting it in ./output directory

ares-package -o output sampleApp

 

Creating a package file for debugging (without minifying the source code)

ares-package --no-minify sampleApp

 

Creating a package file except for testCode1 sub-directory, README.md file and all text file (.txt)

ares-package -e "testCode1" -e "README.md" -e "*.txt" samplePrj

 

Creating a package file with external JS Service directory

ares-package sampleApp sampleService


ares-setup-device

This command displays a list of registered target devices. You can also add, modify or remove them from the list. This command is mainly used to modify taget host address which is running on a remote host.

Usages

ares-setup-device

ares-setup-device [OPTIONS...] --add|-a [TARGET_NAME] [--info|-i [DEVICE_INFO]]

ares-setup-device [OPTIONS...] --modify|-m [TARGET_NAME] [--info|-i [DEVICE_INFO]]

ares-setup-device [OPTIONS...] --remove|-r [TARGET_NAME]

ares-setup-device --search|-s

ares-setup-device [--search|-s] --timeout|-t [TIMEOUT]

ares-setup-device --reset|-R

ares-setup-device --list|-l

ares-setup-device --listfull|-F

ares-setup-device --version|-V

ares-setup-device --help|-h

Options

Option

Parameter

Description

-a, --add

TARGET_NAME

Adds a target device with the specified information.

-m, --modify

TARGET_NAME

Modifies a target device's information. You can change the information of the target device except for its name.

-i, --info

DEVICE_INFO

Sets information for the target device.

-r, --remove

TARGET_NAME

Deletes a target device that matches the device name you enter.

-s, --search None Searches webOS devices in same network with SSDP and displays the found device list. When you select a device from the device list, IP address of the selected device will be set for device information automatically.
-t, --timeout TIMEOUT

Sets timeout value for the --search option. This option does not have to be preceded by the --search option. Default value is 5 (seconds).

-R, --reset

None Initializes the list of registered target devices.

-v

None

Displays the execution log.

-l, --list

None

Lists registered target devices.

-F, --listfull

None

Lists registered target devices' information with more detail (JSON string).

--version

None

Displays the version of ares-setup-device command.

-h, --help

None

Displays the help of ares-setup-device command.

Parameters

Parameter

Description

DEVICE_INFO

Specifies the information of the target device. It can be entered using strings in the format of "Key=Value" or JSON-type such as '{"key1":"value1", "key2":"value2", ...}'. You can use the following items as key for the target device:

  • name: Target device name
  • description: Target device description
  • host: Target device host address
  • port: Target device port number
  • username: User name for accessing the target device. Possible values:
    • root (default) – To be used by internal users only.
    • developer – To access the emulator.
    • prisoner – To connect to the TV device.
  • password: Password for authenticating the root user.
    • By default the password for root user is blank.
    • If password was previously set for a root user, then enter it here.
    • Not applicable for developer and prisoner user.
  • privatekey: File name of SSH private key.
    • Used to authenticate developer and prisoner user. Not applicable for root user.
    • For emulator, the value must be webos_emul (default value).
    • For TV, do not enter anything, leave it blank. The value will be auto-generated by using the passphrase provided by user.
  • passphrase: Passphrase for using the SSH private key file.
    • Not required for developer user.
    • Required only for prisoner user.
    • Auto-generates the SSH private key file for the prisoner.

 

When using CLI in interactive mode, take care when entering the required values or choosing to use the default values, else you might not be able to use the device.

TARGET_NAME

Specifies the name of the target device.
TIMEOUT Timeout for device searching (unit: second).

The following example shows a DEVICE_INFO written in JSON format:

{"host":"127.0.0.1", "port":"6622"}

Examples

Here are some examples of the CLI usage:

Listing target devices

ares-setup-device --list

Adding the target device (Target device name: sampleEmulator, Host address: 10.123.45.67, Port number: 6622 User: developer)

ares-setup-device --add sampleEmulator -i "host=10.123.45.67" -i "port=6622" -i "username=developer"

 

Adding the target device with JSON format (Target device name: sampleEmulator, Host address: 10.123.45.67, Port number:6622 User: developer)

ares-setup-device --add sampleEmulator --info "{'host':'10.123.45.67', 'port':'6622', 'username':'developer'}"

 

Adding the target device with interactive mode (Target device name: sampleEmulator, Host address: 10.123.45.67, Port number: 6622, User: developer)

ares-setup-device

 

name deviceinfo connection Profile

-------- ------------------------ ---------- -------

emulator developer@127.0.0.1:6622 ssh tv

** You can modify the device info in the above list, or add a new device.

? Select: add

? Enter Device Name: sampleEmulator

? Enter Device IP address: 10.123.45.67

? Enter Device Port: 6622

? Enter ssh user: developer

? Enter description: sample

? Select authentification: ssh key

? Enter ssh private key filename: webOS_emul

? Enter keys passphrase:

? Save? Yes

 

name deviceinfo connection profile

-------- --------------------------- ---------- -------

emulator developer@127.0.0.1:6622 ssh tv

sampleEmulator developer@10.123.45.67:6622 ssh tv

 

If you want to input default value or set empty, press the enter key without any value.

 

Modifying the target device (Target device name: sampleEmulator, Port Number: 9922)

ares-setup-device --modify sampleEmulator -i "port=9922"

 

Modifying the target device with interactive mode (Target device name: sampleEmulator, Port number: 9922)

ares-setup-device

 

name deviceinfo connection profile

-------- --------------------------- ---------- -------

emulator developer@127.0.0.1:6622 ssh tv

sampleEmulator developer@10.123.45.67:6622 ssh tv

 

** You can modify the device info in the above list, or add a new device.

? Select: modify

? Enter Device Name: sampleEmulator

? Enter Device IP address: 10.123.45.67

? Enter Device Port: 6622

? Enter ssh user: developer

? Enter description: sample

? Select authentification: ssh key

? Enter ssh private key filename: webOS_emul

? Enter keys passphrase:

? Save? Yes

 

name deviceinfo connection

-------- --------------------------- ----------

emulator developer@127.0.0.1:6622 ssh

sampleEmulator developer@10.123.45.67:9922 ssh

Success to modify a device!!

 

If you want to keep the previous value, press Enter without any value.

 

Removing the target device (Target device name: sampleEmulator)

ares-setup-device --remove sampleEmulator

To remove a target device, you only need to enter the name of the target device following the command.

 

Searching webOS devices

ares-setup-device --search


ares-install

This command installs the app for a specified app package file (.ipk) on the target device. You can also see the list of apps installed on the target device or remove them with this command.

Usages

ares-install [OPTION...] PKG_FILE

ares-install [OPTION...] --remove APP_ID

ares-install [OPTION...] --list|-l [--type|-t APPLICATION_TYPE]

ares-install [OPTION...] --listfull|-F [--type|-t APPLICATION_TYPE]

ares-install --device-list|-D

ares-install --version|-V

ares-install --help|-h

Options

Option

Parameter

Description

-d, --device

TARGET_DEVICE

Specifies the target device on which the application should be installed.

-S

None

Lists storage devices such as internal storage and USB.

-s

None

Specifies the storage where the app should be installed on the device. If you don't specify this option, the app will be installed on the internal storage of the device.

-l, --list

[-t, --type option]

Lists the installed apps on the specified target device. Use this option in conjunction with -d, --device option.

-F, --listfull

[-t, --type option]

Lists installed applications with more detail. Use this option in conjunction with -d, --device option.

-t, --type

APPLICATION_TYPE

Filters corresponding app type from the list of installed apps. Use this option in conjunction with -l, --list option or -F, --listfull option.

--device-list

None

Lists all the available devices.

-v

None

Displays the execution log.

--version

None

Displays the version of ares-install command.

-h, --help

None

Displays the help of ares-install command.

Parameters

Parameter

Description

PKG_FILE

Specifies the path of the app package file.

APP_ID

ID of the app to remove from the device.

TARGET_DEVICE

Specifies the target device for installing or removing the app or viewing the list of installed apps.

APPLICATION_TYPE

Specifies the app type for filtering the installed app list. The supported app type is:

  • web: Web application type

Examples

Here are some examples of the CLI usage:

Listing available target devices

ares-install --device-list

 

Installing the app on the emulator

ares-install --device emulator com.example.sampleapp_0.0.1_all.ipk

 

Listing apps which are installed on the emulator

ares-install --device emulator --list

 

Listing apps which are web application type.

ares-install --device emulator --list --type web

 

Listing the storages in device

ares-install -S --device tv

 

Installing the application to the external storage (USB memory stick)

ares-install -s usb1 --device tv com.example.sampleapp_0.0.1_all.ipk

 

Removing the app from the emulator

ares-install --device emulator --remove com.example.sampleapp


ares-launch

This command runs or terminates the application installed on the target device. This command can also display the list of applications running on the target device.

Usages

ares-launch [OPTION...] APP_ID

ares-launch [OPTION...] --hosted|-H APP_DIR

ares-launch [OPTION...] --close APP_ID

ares-launch [OPTION...] --running|-r

ares-launch --version|-V

ares-launch --help|-h

Options

Option

Parameter

Description

-d, --device

TARGET_DEVICE

Specifies the target device where the web application is installed.

-H, --hosted

APP_DIR

Runs application without installation. An application that includes JS Service cannot be executed with this option.

--close

APP_ID

Terminates application on target device.

-r, --running

None

Lists applications which are running on target device.

-p, --params

PARAMS

Launches a web application with specified parameters.

-v

None

Displays the execution log.

--version

None

Displays the version of ares-launch command.

-h, --help

None

Displays the help of ares-launch command.

Parameters

Parameter

Description

APP_ID

ID of the application to run or terminate.

TARGET_DEVICE

Specifies the target device on which the application is installed.

PARAMS

Specifies the parameters which are used on web application launching. It is entered using JSON-type strings in the format '{"param1":"value1", "param2":"value2 which is containing spaces", ...}'.

Examples

Here are some examples of the different uses:

Running the application installed on the emulator

ares-launch --device emulator com.example.sampleapp

 

Running the application with url parameter

ares-launch --device emulator com.example.sampleapp --params "{'url':'www.lge.com'}"

 

When you use a parameter, web app will receive the parameter with webOSLaunch event. For more detailed on webOSLaunch event, see App Lifecycle.

 

Listing applications running on the emulator

ares-launch --device emulator --running

 

Terminating application currently running

ares-launch --device emulator --close com.example.sampleapp

 

Running the application without installation

ares-launch --device emulator --hosted sampleApp


ares-inspect

This command provides Web Inspector and Node Inspector. The Web Inspector and Node Inspector run on a web browser. Each Inspector displays the running information about the web application or JS Services.

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 web inspector

-o, --open

None

Open the webOS TV SDK bundle browser (Chromium).

-v

None

Displays the execution log.

--version

None

Displays the version of ares-inspect command.

-h, --help

None

Displays the help of 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 emulator --app com.example.sampleapp

 

Running the Web Inspector for a JS Service

ares-inspect --device emulator --service com.example.sampleapp.sampleservice


ares-server

This command runs a web server for testing local file. Web server will run on the given path. You can terminate web server with control-C (in Windows, Linux) or Command-C (in Mac OS).

Usages

ares-server [OPTION...] APP_DIR

ares-server --version|-V

ares-server --help|-h

Options

Option

Parameter

Description

-o, --open

None

Open the webOS TV SDK bundle browser (Chromium).

-v

None

Displays the execution log.

--version

None

Displays the version of ares-server command.

-h, --help

None

Displays the help of ares-server command.

Parameters

Parameter

Description

APP_DIR

Specifies the directory of the application to be published on the web server.

Examples

Here are some examples of the different uses:

Running the Web Server in a source directory

ares-server ./source

 

Running the Web Server with browser

ares-server ./source --open


ares-novacom

This command gets private key from webOS TV for Developer Mode App. After getting private key, you can install, launch app or run a command on webOS TV.

Usages

ares-novacom [OPTION...] --forward|-f [--port|-p DEVICE_PORT1[:HOST_PORT1]][--port|-p DEVICE_PORT2]][...]

ares-novacom [OPTION...] --getkey|-k

ares-novacom --device|-d

ares-novacom --device-list

ares-novacom --version|-V

ares-novacom --help|-h

Options

Option

Parameter

Description

-d, --device

TARGET_DEVICE

Specifies the target device on which the command will be executed.

-f, --forward

List of -p, -port options

Enables port forwarding between a host PC and the target device. You can specify port number with additional option (p-, --port option).

-p, --port

DEVICE_PORT[:HOST_PORT]

Specifies a port for port forwarding.

-k, --getkey

None

Gets a private key from webOS TV. Before using this option, Developer Mode App should be run on webOS TV.

-D, --device-list

None

Lists available target devices.

-v

None

Displays the execution log.

--version

None

Displays the version of ares-novacom command.

-h, --help

None

Displays the help of ares-novacom command.

Parameters

Parameter

Description

DEVICE_PORT

Specifies the target device's port number for port forwarding between the host PC and the target device. If only DEVICE_PORT is specified, host PC uses same port number for port forwarding.

HOST_PORT

Specifies the host PC's port number for port forwarding between the host PC and the target device.

Examples

Here are some examples of the different uses:

Getting private key from webOS TV (Needed Developer Mode App setting)

ares-novacom --device tv --getkey

 

Setting port forwarding between emulator (6622) and host PC (3030)

ares-novacom --forward --port 6622:3030 -d emulator



Navigation