Skip to content

Repository

Pouya Eghbali edited this page Jul 4, 2021 · 8 revisions

Please refers to its software repository in order to get the instructions for installing, building or running the commands. You can find a list of available commands in repo/commands directory.

Additionally, default configurations for each environment can be stored in repo/configs directory.

Directory structure

Within each command directory, there can be found four different subdirectories, which can be one of the following:

Subdirectory Description
install Install instructions for the commands, using the package managers of each environment
build Build instructions for each platform, or environment
prebuilt Prebuilt, fetch and uncompress instructions for each environment
script JavaScript implementation of the commands

Inside each of the above subdirectories, you may find files built for each platform, refer to "module resolution" section in order to learn more.

Module resolution mechanism

All installation, build, prebuilt and script files in the Please repo follow the same naming mechanism:

${os}.${variant}.${release}.${arch}

Where:

  1. os is the OS name, type, class or family (eg. windows, macos, bsd, linux or any)
  2. variant is the distribution, variant or version (eg. 10, ubuntu, debian, freebsd or any)
  3. release is the subversion, release or build number (eg. 18363, 20.04, 10 or any)
  4. arch is the cpu architecture (eg. arm64, x64, or any)

Please first tries the exact values for each of the parameters, then switches to any, one parameter at a time from right to left. The any exchange order is as follows:

  1. ${os}.${variant}.${release}.${arch}
  2. ${os}.${variant}.${release}.any
  3. ${os}.${variant}.any.${arch}
  4. ${os}.${variant}.any.any
  5. ${os}.any.any.any
  6. any.any.any.any

Module definitions

Each module, can either be a JavaScript file, or a subdirectory. If the module is a subdirectory, please expects an index.js file in that directory as the entry point of the module. A package.json file can be added to the module subdirectory, the dependencies listed in the package.json file get installed before running the command.

Depending on the their functionality and use case, modules need to export a specific JavaScript function:

Functionality Should export Should expect arguments
install install config
build build config
prebuilt prebuilt config
script run argv and config

Where:

  1. config argument, is the Please config file, parsed, all CLI overrides and flags included.
  2. argv are the arguments passed to the command by the user.

Module examples

Command Module type OS Variant Release Arch Description
reverse Script (file) Any Any Any Any A command that prints back the input in reverse
download Script (directory) Any Any Any Any A command that downloads and saves a single file
docker Install (file) Linux Ubuntu Any x64 Install file for Docker, Ubuntu specific

User's guide

Home
CLI Usage
Configuration
CNF
FAQ

Developer's guide

Repository
Please API

Clone this wiki locally