Skip to content

LibMan CLI Reference

Justin Clareburt edited this page Jun 21, 2018 · 1 revision

This page provides a reference for the LibMan CLI (Library Manager Command Line Interface).

LibMan Commands

Usage: libman [options] [command]

Options:

--help|-h Show help information
--version Show version information

The following commands are available on the LibMan tool:

Commands:

init Create a new libman.json
install Add a library definition to the LibMan.json file, and download the library to the specified location
uninstall Deletes all files for the specified library from their specified destination, then removess the specified library definition from libman.json
restore Downloads all files from provider and saves them to specified destination
update Updates the specified library
clean Deletes all library files defined in libman.json from the project
cache List or clean libman cache contents

Use "libman [command] --help" for more information about a command.

Command Details

Help flag

Usage: --help|-h

Prints a list of all available LibMan verbs.
If parameter supplied, will print the full details of the supplied verb.

Examples:

  • libman --help
  • libman -h

Version flag

Usage: --version

Prints the current version of the LibMan executable.

Examples:

  • libman --version

Init

Usage: libman init [options]

Options:

--help|-h Show help information
--verbosity Set the verbosity of output (eg. "normal", "detailed", "quiet")
--default-provider|-p The provider to use if no provider is defined for a given library. (eg. “cdnjs”, “filesystem”)
--default-destination|-d The path, relative to the current directory, where library files should be installed if no destination is defined for a given library.

Remarks:
Creates new libman.json in the current directory.
Will throw an error if libman.json already exists.
Will prompt for a defaulDestination if none provided.

Examples:

  • libman init (interactive)
  • libman init --default-provider "cdnjs"
  • libman init --version "1.0"
  • libman init --version 1.0 --default-provider cdnjs --default-destination script\libman

Install

Usage: libman install [arguments] [options]

Arguments:

libraryId Library to uninstall

Options:

--help|-h Show help information
--verbosity Set the verbosity of output (eg. "normal", "detailed", "quiet")
--provider|-p Provider to use (if not specified, the default provider will be used)
--destination|-d Location to install the library (if not specified, the default destination location will be used)
--files The files from the specified library to install (if not specified, all files from the library will be installed)

Remarks:
Adds the specified library definition to the libman.json and downloads the files to the destination specified.
Initializes a libman.json if one does not exist.
If no default provider exists, --provider option is required.
If no default destination exists, --destination option is required.
If no files are specified, the entire library is included.

Examples:

  • libman install [email protected]
  • libman install jquery --provider cdnjs --destination wwwroot\scripts\jquery --files jquery.min.js
  • libman install myCalendar --provider filesystem --files calendar.js --files calendar.css

Uninstall

Usage: libman uninstall [arguments] [options]

Arguments:

libraryId Library to uninstall

Options:

--help|-h Show help information
--verbosity Set the verbosity of output (eg. "normal", "detailed", "quiet")

Remarks:
Deletes the library file/s from the specified destination, then remove the specified library config from libman.json. Will throw error if no libman.json in current folder
Will throw error if specified library doesn't exist
If there's more than one library with the same libraryId, you'll be prompted to choose.

Examples:

Restore

Usage: libman restore [options]

Options:

--help|-h Show help information
--verbosity Set the verbosity of output (eg. "normal", "detailed", "quiet")

Remarks:
Downloads all files from provider and saves them to configured destination.
Will throw error if no libman.json in current folder
If a library specifies a provider, it will override the defaultProvider
If a library specifies a destination, it will override the defaultDestination

Update

Usage: libman update [arguments] [options]

Arguments:

libraryId Library to update

Options:

--help|-h Show help information
--verbosity Set the verbosity of output (eg. "normal", "detailed", "quiet")
-pre If specified, the latest pre-release version of the library will be downloaded (where applicable)
--to The version to update the library to (needs complete libraryid for the provider)

Remarks:
Updates the specified library to the latest version.
Error if no libman.json in current folder
Error if specified library doesn't exist
If there's more than one library with the same libraryId, you'll be prompted to choose.

Examples:

  • libman update jquery
  • libman update jquery --to 3.3.1
  • libman update jquery -pre

Clean

Usage: libman clean [options]

Options:

--help|-h Show help information
--verbosity Set the verbosity of output (eg. "normal", "detailed", "quiet")

Remarks:
Deletes from the local project all library files defined in libman.json.
Deletes any folders that become empty after this operation.

Cache

Usage: libman cache [options] [command]

Options:

--help|-h Show help information
--verbosity Set the verbosity of output (eg. "normal", "detailed", "quiet")

Commands:

clean Delete all files from the local machine's LibMan cache.
list Display a list of all libraries that are stored in the local machine’s LibMan cache.

Cache Clean

Usage: libman cache clean [arguments] [options]

Arguments:

provider Provider for which the cache files should be cleaned.

Options:

--help|-h Show help information
--verbosity Set the verbosity of output (eg. "normal", "detailed", "quiet")

Remarks:
Delete all files from the local machine's LibMan cache. (This is the local cache that's usually kept in the user's home directory.)

Cache List

Usage: libman cache list [arguments] [options]

Options:

--help|-h Show help information
--verbosity Set the verbosity of output (eg. "normal", "detailed", "quiet")
--files List files that are cached for each library.
--libraries List the libraries cached for each provider.

Remarks:
Lists the libraries in the local machine's LibMan cache. (This is the local cache that's usually kept in the user's home directory.)