VersionSmartLineCommand
extends SmartLineCommand
in package
The version command
Prints current hg revision, if we're in prod or dev environment and the current revision's hash.
The version and env information is extracted from .hg/tags.cache (indicating we're in a Mercurial repo and so in a dev environment), or from version.txt file (indicating we've deployed code in a production environment)
e.g. r130 (development environment) Hash: 057bf394741706fd2136541e3bb07c9e60b4963d
Table of Contents
Constants
- GIT_FOLDER = ".git"
Properties
- $SmartLine : SmartLine
- The SmartLine where this instance of the command is registered
Methods
- __construct() : mixed
- Initializes a new instance of the SmartLine Command
- help() : string|bool
- Gets the command help text or indicates help should be fetched from $lang array
- run() : mixed
- Runs the command
- parseBoolean() : bool
- getGitHash() : string
Constants
GIT_FOLDER
public
mixed
GIT_FOLDER
= ".git"
Properties
$SmartLine
The SmartLine where this instance of the command is registered
public
SmartLine
$SmartLine
Methods
__construct()
Initializes a new instance of the SmartLine Command
public
__construct(SmartLine $SmartLine) : mixed
Parameters
- $SmartLine : SmartLine
-
the SmartLine the command belongs
help()
Gets the command help text or indicates help should be fetched from $lang array
public
help() : string|bool
Return values
string|bool —a string containing the command help or the bool value false, to enable the default behavior (ie prints $lang['help']['nameOfTheCommand'])
run()
Runs the command
public
run(array<string|int, mixed> $argv, int $argc) : mixed
Parameters
- $argv : array<string|int, mixed>
-
an array of string, each item a command argument
- $argc : int
-
the number of arguments
parseBoolean()
protected
static parseBoolean(string $arg) : bool
Parameters
- $arg : string
Return values
boolgetGitHash()
private
static getGitHash() : string