NacoWiki PHP API

Cli
in package

Main CLI implementation

This class implements the built-in CLI sub-commands. It also contains utility functions for CLI use.

Table of Contents

Constants

NONL  = 2
Used by stderr to prevent printing of a New line at the end
TRC  = 1
Used by stderr to make it report caller traceback info

Methods

help()  : bool|null
Show this help
install()  : bool|null
Install assets
lint1()  : bool|null
Dump left-over metadata files
load()  : void
Loading entry point for this class
plugins()  : bool|null
List available plugins
relativePath()  : string
Given two paths, calculate the relative path from one to the other
stderr()  : void
output message to stderr

Constants

NONL

Used by stderr to prevent printing of a New line at the end

public int NONL = 2

TRC

Used by stderr to make it report caller traceback info

public int TRC = 1

Methods

help()

Show this help

public static help(NanoWikiApp $wiki, array<string|int, mixed> $argv) : bool|null

This implements a CLI sub-command for HELP

It will look into the plugin configuration and display what are the available sub-commands. In addition if there is a docstring for the implementing function, it will display it. It also shows what plugin's class is providing this command.

Parameters
$wiki : NanoWikiApp

running wiki instance

$argv : array<string|int, mixed>

Command line arguments

Tags
event

cli:help

phpcod

commands##help

Return values
bool|null

install()

Install assets

public static install(NanoWikiApp $wiki, array<string|int, mixed> $argv) : bool|null

This implements a CLI sub-command for plugins.

This will check if the assets directory specified in the \NanoWikiApp configuration exists, and if it does not exist, it will create it.

Parameters
$wiki : NanoWikiApp

running wiki instance

$argv : array<string|int, mixed>

Command line arguments

Tags
event

cli:install

phpcod

commands##install

Return values
bool|null

lint1()

Dump left-over metadata files

public static lint1(NanoWikiApp $wiki, array<string|int, mixed> $argv) : bool|null

This will look for dot files that do not have a matching content.

Parameters
$wiki : NanoWikiApp

running wiki instance

$argv : array<string|int, mixed>

Command line arguments

Tags
event

cli:lint

phpcod

commands##lint

Return values
bool|null

load()

Loading entry point for this class

public static load() : void

Adds commands implemented by this class

plugins()

List available plugins

public static plugins(NanoWikiApp $wiki, array<string|int, mixed> $argv) : bool|null

This implements a CLI sub-command for plugins.

This looks in the plugin configuration and shows what plugins are currently available, its source file and the plugin version if any

Parameters
$wiki : NanoWikiApp

running wiki instance

$argv : array<string|int, mixed>

Command line arguments

Tags
event

cli:plugins

phpcod

commands##plugins

Return values
bool|null

relativePath()

Given two paths, calculate the relative path from one to the other

public static relativePath(string $from, string $to[, string $ps = DIRECTORY_SEPARATOR ]) : string
Parameters
$from : string

from directory

$to : string

target location

$ps : string = DIRECTORY_SEPARATOR

directory separator.

Return values
string

relative path to target location

stderr()

output message to stderr

public static stderr(string $msg[, int $flags = 0 ]) : void

This method is used to output text to the stderr channel.

Available flags:

  • TRC : trace dump of the calling function/context
  • NONL : do not print EOL after $msg.
Parameters
$msg : string

text to display on stderr

$flags : int = 0

OR'ed flags to control output.


        
On this page

Search results