Home Manual Reference Source Test
import DocsCommand from 'atscm-cli/src/cli/commands/Docs.js'
public class | source

DocsCommand

Extends:

Command → DocsCommand

The command invoked when running "docs". Handles the options --cli and --browser.

Test:

Static Member Summary

Static Public Members
public static get

Base URL of the hosted API documentation.

Constructor Summary

Public Constructor
public

constructor(name: string, description: string)

Creates a new DocsCommand with the specified name and description.

Method Summary

Public Methods
public

addressToOpen(cli: AtSCMCli): {address: string, isPath: boolean}

Returns the path or url to open.

public

Returns the path to the local api docs.

public

Returns the URL of the remote api docs.

public

Returns false if the --cli option is used.

public

Opens the requested docs in the requested browser.

Inherited Summary

From class Command
public get

The minimum and maximum number of (non-option) arguments the command handles.

public get

The options available for the command.

public get

If an error should be thrown for unknown arguments.

public get

Returns the usage string for the command.

public

The command descriptions.

public

The command's name.

private

The command's raw options.

public

Returns true if the command requires a Liftoff.Environment before it can be run.

public

run(cli: AtSCMCli)

Runs the command with the current Cli instance.

Static Public Members

public static get RemoteDocsBase: string source

Base URL of the hosted API documentation.

Public Constructors

public constructor(name: string, description: string) source

Creates a new DocsCommand with the specified name and description.

Override:

Command#constructor

Params:

NameTypeAttributeDescription
name string

The command's name.

description string

The command's description.

Public Methods

public addressToOpen(cli: AtSCMCli): {address: string, isPath: boolean} source

Returns the path or url to open. This is resolved in the following way:

  1. If --remote is passed, always return the URL of the hosted docs of atscm-cli or atscm based on the --cli option passed.
  2. If --cli is passed, always return the path to the local atscm-cli docs.
  3. Otherwise, check if a local module was found:
    • If true return the local module docs path,
    • else return the URL of the hosted atscm docs.

Params:

NameTypeAttributeDescription
cli AtSCMCli

The calling Cli instance.

Return:

{address: string, isPath: boolean}

The resolved address and a flag indicating if the address describes a file path.

Test:

public localDocsPath(cli: AtSCMCli): string source

Returns the path to the local api docs.

Params:

NameTypeAttributeDescription
cli AtSCMCli

The current Cli instance.

Return:

string

The path to the local api docs.

Test:

public remoteDocsUrl(cli: AtSCMCli): string source

Returns the URL of the remote api docs.

Params:

NameTypeAttributeDescription
cli AtSCMCli

The current Cli instance.

Return:

string

The URL of the remote api docs.

Test:

public requiresEnvironment(cli: AtSCMCli): boolean source

Returns false if the --cli option is used.

Override:

Command#requiresEnvironment

Params:

NameTypeAttributeDescription
cli AtSCMCli

The current cli instance.

Return:

boolean

false if the --cli option is used.

Test:

public run(cli: AtSCMCli): Promise source

Opens the requested docs in the requested browser.

Override:

Command#run

Params:

NameTypeAttributeDescription
cli AtSCMCli

The current Cli instance.

Return:

Promise

Resolved after the os-specific open command was started.

Test: