Skip to content

02. CLI commands

Nikolay Soloviev edited this page Apr 21, 2020 · 13 revisions

Available commands:

Config

Update ZPM settings. The setting is a key-value pair.

Command: config <action> [<key> [<value>]]

Arguments:
    action - one of settings actions: list, get, set, delete
    key - setting key
    value - setting value

Examples:

config set analytics 0 disable collecting analytics data

config set analytics 1 enable collecting analytics data

config list list all settings

config get analytics get value for analytics key

config delete analytics reset to default value for analytics key

Help

Displays help information for the shell or a particular command

Command: help [flags] [<command>]

Alias: ?

Flags:

    -markdown
    Print detail in markdown format (for easy transfer to external documentation)
    alias(es): -m

    -verbose
    Show full detail
    alias(es): -v

Arguments:

    command
        Command for which help information should be displayed

Examples:

help -v install

Install

Installs a module available in a configured repository

Command: install [flags] [<module> [<version>]]

Flags:

    -dev
    Sets the DeveloperMode flag for the module's lifecycle. Key consequences of this are that ^Sources will be configured for resources in the module, and installer methods will be called with the dev mode flag set.

    -keywords <value>
    Searches for modules matching some set of keywords.
    alias(es): -k

    -quiet
    Produces minimal output from the command.
    alias(es): -q

    -verbose
    Produces verbose output from the command.
    alias(es): -v

Arguments:

    module
        Name of module to install

    version
        Version (or version expression) of module to install; defaults to the latest available if unspecified.

Examples:

install restforms2
Installs the most recent version of restforms2 available in any configured repository in the current namespace.

List-dependents

Lists modules dependent on the specified module

Command: list-dependents [flags] <module> [<version>]

Alias: dependents

Flags:

    -repos <value>
    Comma-separated list of repository names to search in. If unspecified, the version of the module in the current namespace will be used instead.
    alias(es): -r

    -tree
    If specified, show as a tree (rather than a flattened list)
    alias(es): -t

Arguments:

    module
        Name of module for which dependent modules will be found

    version
        Version of the module for which dependent modules will be found (in all configured repositories)

Examples:

list-dependents HS.JSON
    Lists all currently-installed modules dependent on the currently-installed 'HS.JSON' version

list-dependents -repos AppModules HS.JSON
    Lists all modules in the 'AppModules' repository dependent on all 'HS.JSON' versions.

dependents -t -r AppModules HS.JSON 0.0.1+snapshot
    Lists all modules in the 'AppModules' repository dependent on 'HS.JSON' version '0.0.1+snapshot', as a tree.

list-installed

Lists modules installed in the current namespace

Command: list-installed [flags] Alias: list

Flags     -tree
    If specified, show dependency tree for installed modules
    alias(es): -t

Examples list-installed -tree
    Shows all installed modules in tree format.

Load

Loads a module from the specified directory or archive into the current namespace. Dependencies are also loaded automatically, provided that they can be found in repositories configured with the 'repo' command.

Command: load [flags] <path>

Flags:

    -dev
    Sets the DeveloperMode flag for the module's lifecycle. Key consequences of this are that ^Sources will be configured for resources in the module, and installer methods will be called with the dev mode flag set.

    -quiet
    Produces minimal output from the command.
    alias(es): -q

    -verbose
    Produces verbose output from the command.
    alias(es): -v

Arguments:

    path
        Directory on the local filesystem, containing a file named module.xml

Examples:

load C:\module\root\path\
load C:\module\root\path\module-0.0.1.tgz
    Loads the module described in C:\module\root\path\module.xml

load -dev -verbose C:\module\root\path\
load -dev -verbose C:\module\root\path\module-0.0.1.tgz
    Loads the module described in C:\module\root\path\module.xml in developer mode and with verbose output.

Module-action

Performs operations on modules - compiling, running tests, packaging/registering, etc.

module-action <module> <actions> [flags]

You can use this by starting a command with the module name.

<module> <actions> [flags]

Note that flags appear after all actions.

The standard lifecycle phases are:

  • clean: removes all dependencies that are not required by other installed modules and their resources. Dependencies required by other modules will also be removed if the -DClean.Force=1 flag is specified.
  • reload: pulls module source code into the namespace from disk. Does not compile.
  • validate: ensures that module API section is up to date, that module resource processor attributes are valid, and that the resources exported to the filesystem (and possible to source control) are consistent with what is in the database.
  • compile: compiles all resources within the module.
  • activate: performs post-compilation installation/configuration steps.
  • test: runs any unit tests associated with the module, in the current namespace.
  • package: exports the module's resources and bundles them into a module artifact (.tgz file).
  • verify: installs that artifact in a separate namespace, then runs integration tests (if any).
  • register: saves that artifact into the current namespace's module cache. This is accessible to other instances configured to look at the current namespace as a module repository.
  • publish: saves that artifact to the repository for which deployment is enabled. Currently, there may only be one of these per namespace.

Flags:

    -dev
    Sets the DeveloperMode flag for the module's lifecycle. Key consequences of this are that ^Sources will be configured for resources in the module, and installer methods will be called with the dev mode flag set.

    -only
    Only runs the specified phase(s), rather than also running predecessors.
    alias(es): -o

    -quiet
    Produces minimal output from the command.
    alias(es): -q

    -verbose
    Produces verbose output from the command.
    alias(es): -v

Arguments:

    module
        Name of module on which to perform lifecycle actions

    actions
        Space-delimited list of module lifecycle phases to run

Examples:

module-action MyModuleName compile
Compiles the module named "MyModuleName"

MyModuleName clean register
Performs multiple actions on the module named "MyModuleName"; "clean" deletes all of its dependenices, and "install" will then re-download them, package the module, and register it in the current namespace's module cache.

MyUIModule compile -v -Dmyparam=42
Compiles the module named MyUIModule with verbose output and pParams("myparam") (passed to all lifecycle phases) set to 42.

Orphans

Lists resources in the current namespace's default code database that are not part of any module.

Command: orphans [flags]

Flags:

    -type <value>
    Type (e.g., extension) of resource to show; if unspecified, all types are included.
    alias(es): -t

Examples: orphans -type CLS

Quit

Exits the package manager shell

Command: quit

Aliases: q, exit

Repo

Configures the current namespace to search for modules on a remote server or on the local filesystem.

Command: repo [flags]

Alias: repository

Flags:

    -app <value>
    When enabling a namespace to serve as a remote repository, specifies the web application to allow web service access.

    -delete
    Deletes the current namespace's reference to the named repository

    -delete-all
    Deletes all repositories (possibly subject to a type filter: -f, -r, -l)

    -depth <value>
    For filesystem repositories, specifies the depth (number of folders underneath the root) to search for files named module.xml
    alias(es): -d

    -filesystem
    Create/update a filesystem repository
    alias(es): -f, -fs

    -list
    Lists all repositories (possibly subject to a type filter: -f, -r, -l)

    -list-modules
    List modules available in the specified repository (-n[ame]), or in all configured repositories if no repository was specified.

    -local
    Create/update the local namespace cache
    alias(es): -l

    -name <value>
    Namespace-unique name for the module
    alias(es): -n

    -password <value>
    For remote repositories, specifies the password to use when connecting.
    alias(es): -pass

    -path <value>
    For filesystem repositories, specifies the path to the root directory
    alias(es): -p

    -prereleases <0/1>
    For any repository, specifies that it should be used to look for prerelease software
    alias(es): -pre

    -publish <0/1>
    When configuring a remote repository, specifies that publishing of packages to the repository is allowed. When configuring the current namespace with -enable, specifies that publishing is also enabled.

    -remote
    Create/update a remote server repository
    alias(es): -r

    -reset-defaults
    Reset to default remote repository

    -snapshots <0/1>
    For any repository, specifies that it should be used to look for snapshot builds (i.e., those with a semantic version ending in '+snapshot', indicating a 'latest' build of a particular version).
    alias(es): -s

    -type <value>
    Subclass of %ZPM.PackageManager.Client.ServerDefinition to create/modify/delete or implementation of %ZPM.PackageManager.Core.IPackageService or %ZPM.PackageManager.Core.IPublishService to enable/disable
    alias(es): -t

    -url <value>
    For remote repositories, specifies the URL for package retrieval web services.

    -username <value>
    For remote repositories, specifies the username to use when connecting.
    alias(es): -user

Examples

repo -list
List all repositories

repo -delete-all
Delete all repositories

repo -name LocalFiles -snapshots 1 -fs -depth 2 -path C:\MyWorkspace\RootModuleDir\
Create a repository pointing to the filesystem with name LocalFiles, accepting snapshots, looking for files named module.xml up to 2 directories deep in C:\MyWorkspace\RootModuleDir\

repo -n LocalFiles -delete
Delete the repository named "LocalFiles"

repo -n AppModules -list-modules
Lists all modules (and versions) available from the repository named "AppModules"

repo -r -n registry -reset-defaults
Reset to default registry (pm.community.intersystems.com) and it is equivalent to a command
repo -r -n registry -url https://pm.community.intersystems.com/ -user "" -pass ""

Search

Shows all modules in current registry

Command: search

Alias: find

Flags:

    -show-repo
    Shows github repository for each module.
    alias(es): -r

Examples:

search
Shows all modules in current registry

Uninstall

Uninstalls a module currently installed locally. This will be prevented if other modules depend on the named module, unless the -force flag is specified.

Command: uninstall [flags] <module>

Flags:

    -force
    If specified, the module will be uninstalled even if other modules depend on it.
    alias(es): -f

    -purge
    Purge data from tables during uninstall.

    -quiet
    Produces minimal output from the command.
    alias(es): -q

    -recurse
    Also recursively uninstall dependencies. By default, will not uninstall dependencies that are also required by other installed modules; the -force flag overrides this.
    alias(es): -r

    -verbose
    Produces verbose output from the command.
    alias(es): -v

Arguments

    module
        Name of a module to uninstall

Examples

uninstall restforms2
Uninstalls restforms2 from the current namespace.

Clone this wiki locally