Skip to content

Commit

Permalink
Add "bin" info in composer
Browse files Browse the repository at this point in the history
  • Loading branch information
BafS committed Aug 31, 2023
1 parent f74d5c8 commit 0359bb7
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
## Run in the terminal

- `composer i`
- `./bin/app.php <yourgame.ch8>`
- `./bin/chip8 <yourgame.ch8>`

The default keyboard layout was mapped as follows:
```
Expand All @@ -25,6 +25,16 @@ A|0|B|F -> Z|X|C|V

- `./vendor/bin/phpunit tests/ --testdox`

## Quality

### Static Analysis

- `./vendor/bin/phpstan analyse src/ -l 7`

### Syntax lint

- `./vendor/bin/phpcs --standard=PSR12 src/`

#### Documentation

- https://chip-8.github.io/
Expand Down
7 changes: 5 additions & 2 deletions bin/app.php → bin/chip8
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#!/usr/bin/env php
<?php

declare(strict_types=1);

namespace BafS\Chip8\Bin;

require './vendor/autoload.php';

use BafS\Chip8\CPU;
Expand Down Expand Up @@ -110,8 +113,8 @@ private function execute(InputInterface $input, OutputInterface $output): int
public function run(): int
{
return (new SingleCommandApplication())
->addArgument('file', InputArgument::OPTIONAL, 'The rom')
->addOption('frequency', 'f', InputOption::VALUE_REQUIRED)
->addArgument('file', InputArgument::REQUIRED, 'The rom file')
->addOption('frequency', 'f', InputOption::VALUE_REQUIRED, 'Run the emulation with the given frequency')
->setCode($this->execute(...))
->run();
}
Expand Down
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
"email": "fabacrans@gmail.com"
}
],
"bin": [
"bin/chip8"
],
"require": {
"php": ">=8.1",
"symfony/console": "^6.0"
Expand Down

0 comments on commit 0359bb7

Please sign in to comment.