Skip to content

Commit

Permalink
docs: upgrade cli-commands
Browse files Browse the repository at this point in the history
  • Loading branch information
Chemaclass committed Jun 11, 2024
1 parent 4149308 commit cbe6f2d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 14 deletions.
32 changes: 20 additions & 12 deletions content/documentation/cli-commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,31 +22,33 @@ php phel build
# --source-map|--no-source-map Enable source maps
```

Compile the current project into the `out-dir` folder. This means that the compiled phel code into PHP will be saved in that directory, so you can run the PHP code directly using the PHP interpreter. This will improve the runtime performance, because there won't be a need to compile the code again.
Build the current project into the main php path. This means that the compiled phel code into PHP will be saved in that directory being the entry point the `out/index.php`, and you can run the PHP code directly using the PHP interpreter. This will improve the runtime performance, because there won't be a need to compile the code again.

[Configuration](/documentation/configuration/) in `phel-config.php`:
[Configuration](/documentation/configuration/#buildconfig) in `phel-config.php`:
```php
<?php
return (new PhelConfig())
->setOutDir('out');
return (new \Phel\Config\PhelConfig())
->setBuildConfig((new \Phel\Config\PhelBuildConfig())
->setMainPhelNamespace('your-ns\index')
->setMainPhpPath('out/index.php'));
```

## Export definitions

Export all definitions with the meta data `{:export true}` as PHP classes.
Export all definitions with the metadata `{:export true}` as PHP classes.

It generates PHP classes at namespace level and a method for each exported definition. This allows you to use the exported phel functions from your PHP code.

```bash
vendor/bin/phel export
```

[Configuration](/documentation/configuration/) in `phel-config.php`:
[Configuration](/documentation/configuration/#export-definitions) in `phel-config.php`:
```php
<?php
return (new PhelConfig())
->setExport((new PhelExportConfig())
->setDirectories(['src'])
return (new \Phel\Config\PhelConfig())
->setExportConfig((new \Phel\Config\PhelExportConfig())
->setFromDirectories(['src'])
->setNamespacePrefix('PhelGenerated')
->setTargetDirectory('src/PhelGenerated'));
```
Expand Down Expand Up @@ -98,12 +100,11 @@ vendor/bin/phel run
# -t, --with-time With time awareness
```

[Configuration](/documentation/configuration/) in `phel-config.php`:
[Configuration](/documentation/configuration/#srcdirs) in `phel-config.php`:
```php
<?php
return (new PhelConfig())
->setSrcDirs(['src'])
->setTestDirs(['tests']);
->setSrcDirs(['src']);
```

Read more about [running the code](/documentation/getting-started/#running-the-code) in the getting started page.
Expand All @@ -126,6 +127,13 @@ vendor/bin/phel test

```

[Configuration](/documentation/configuration/#testdirs) in `phel-config.php`:
```php
<?php
return (new PhelConfig())
->setTestDirs(['tests']);
```

Use the `filter` option to run only the tests that contain that filter.

[Configuration](/documentation/configuration/) in `phel-config.php`:
Expand Down
4 changes: 2 additions & 2 deletions content/documentation/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ The configuration when running the `phel build` command.
```php
<?php
return (new \Phel\Config\PhelConfig())
->setOut((new PhelBuildConfig())
->setBuildConfig((new \Phel\Config\PhelBuildConfig())
->setMainPhelNamespace('your-ns\index')
->setMainPhpPath('out/index.php'))
# ...
Expand All @@ -157,7 +157,7 @@ Set configuration options that are being used for the `phel export` command that
```php
<?php
return (new \Phel\Config\PhelConfig())
->setExport((new \Phel\Config\PhelExportConfig())
->setExportConfig((new \Phel\Config\PhelExportConfig())
->setFromDirectories(['src'])
->setNamespacePrefix('PhelGenerated')
->setTargetDirectory('src/PhelGenerated'))
Expand Down

0 comments on commit cbe6f2d

Please sign in to comment.