Skip to content

Version 0.1.0: Kirby's Scooter Universe

Pre-release
Pre-release

Choose a tag to compare

@nubs nubs released this 28 May 23:36
· 107 commits to master since this release

This is the initial release of sensible, a PHP library for finding sensible user programs, like editor, pager, and browser. Currently there is only a class for getting the default editor.

Major Features

Sensible Editor

The \Nubs\Sensible\Editor class makes it easy to get the path to the user's preferred editor. If available, the sensible-editor command (from debian) is used. Otherwise the EDITOR environment variable is consulted. If that still fails to find an editor, then a default editor, /bin/ed is used.

$sensibleEditor = new \Nubs\Sensible\Editor();
$editor = $sensibleEditor->get();

The class takes seveal options on initialization:

$sensibleEditor = new \Nubs\Sensible\Editor(
    [
        'sensibleEditorPath' => '/path/to/sensible-editor', // defaults to /usr/bin/sensible-editor
        'defaultEditorPath' => '/path/to/default/editor', // defaults to /bin/ed
        'environment' => \Habitat\Habitat::getInstance()->getEnvironment(), // defaults to null (use built-in getenv)
    ]
);