Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,28 @@ php artisan vendor:publish --tag=laranail::console-config
php artisan vendor:publish --tag=laranail::console-lang
```

## Quick start

```php
use Simtabi\Laranail\Console\Facades\Console;
use Simtabi\Laranail\Console\Tools\Commands\Command;

final class ReleaseSummaryCommand extends Command
{
protected $signature = 'release:summary';

public function handle(): int
{
$this->output->writeln(Console::status()->success('Build complete'));
echo Console::box(['Version: 2.4.0', 'Env: production'])->title('Release')->render();

return self::SUCCESS;
}
}
```

The full walkthrough is in [Getting started](docs/getting-started.md); everything else is in the [documentation index](#documentation).

## Documentation

Full documentation is at **[opensource.simtabi.com/documentation/laranail/console](https://opensource.simtabi.com/documentation/laranail/console/)** — installation, getting started, the design system, architecture, configuration, and per-subsystem reference (theming, colours, typography, Markdown, charts, widgets, banners, panels, menus, the full-screen TUI, prompts & forms, and more).
Expand Down
5 changes: 4 additions & 1 deletion tests/Tools/Support/EmojisBridgeCatalogueTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Simtabi\Laranail\Console\Tools\Tests\Support;

use PHPUnit\Framework\TestCase;
use Symfony\Component\Console\Helper\Helper;
use Simtabi\Laranail\Console\Tools\Support\Emoji;
use Simtabi\Laranail\Console\Tools\Support\DisplayWidth;
use Simtabi\Laranail\Console\Tools\Support\EmojisBridge;
Expand Down Expand Up @@ -77,7 +78,9 @@ public function test_a_failing_catalogue_degrades_to_the_built_in_behaviour(): v
self::assertSame('❌', Emoji::make()->unicode()->get('cross'));
self::assertSame('', Emoji::make()->get('unicorn'));
self::assertSame('ship 🚀', Emoji::make()->ascii()->render('ship 🚀'));
self::assertSame(1, DisplayWidth::of("\u{1FAEA}"));
// Whatever Symfony itself measures: its width table learns new emoji over time
// (8.1.8 widened U+1FAEA to 2), and the fallback promises to agree with it, not with 1.
self::assertSame(Helper::width("\u{1FAEA}"), DisplayWidth::of("\u{1FAEA}"));
}

public function test_discovery_finds_the_adapter_exactly_when_it_is_autoloadable(): void
Expand Down
5 changes: 4 additions & 1 deletion tests/Tools/Support/EmojisBridgeFallbackTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Simtabi\Laranail\Console\Tools\Tests\Support;

use PHPUnit\Framework\TestCase;
use Symfony\Component\Console\Helper\Helper;
use Simtabi\Laranail\Console\Tools\Support\Emoji;
use Simtabi\Laranail\Console\Tools\Support\DisplayWidth;
use Simtabi\Laranail\Console\Tools\Support\EmojisBridge;
Expand Down Expand Up @@ -60,6 +61,8 @@ public function test_emoji_sequences_measure_two_columns_without_the_catalogue()
public function test_an_emoji_newer_than_the_width_table_keeps_the_symfony_measurement(): void
{
// The documented limit of the fallback: without a catalogue, nothing says U+1FAEA is an emoji.
self::assertSame(1, DisplayWidth::of("\u{1FAEA}"));
// Whatever Symfony itself measures: its width table learns new emoji over time
// (8.1.8 widened U+1FAEA to 2), and the fallback promises to agree with it, not with 1.
self::assertSame(Helper::width("\u{1FAEA}"), DisplayWidth::of("\u{1FAEA}"));
}
}
Loading