Add --path option to display configuration storage path

This commit is contained in:
netkas 2024-09-23 13:44:19 -04:00
parent 02d1cdc8d0
commit 6660af9fda

View file

@ -38,6 +38,7 @@
$editor = $args['editor'] ?? @$args['e'] ?? null; $editor = $args['editor'] ?? @$args['e'] ?? null;
$export = $args['export'] ?? null; $export = $args['export'] ?? null;
$import = $args['import'] ?? null; $import = $args['import'] ?? null;
$path = $args['path'] ?? null;
if($configuration_name === null) if($configuration_name === null)
{ {
@ -55,6 +56,12 @@
exit(1); exit(1);
} }
if($path !== null)
{
print($configuration->getPath() . PHP_EOL);
exit(0);
}
if($import !== null) if($import !== null)
{ {
try try
@ -154,6 +161,7 @@
print(' -e, --editor <editor> (Optional) The editor to use (eg; nano, vim, notepad) (External)' . PHP_EOL); print(' -e, --editor <editor> (Optional) The editor to use (eg; nano, vim, notepad) (External)' . PHP_EOL);
print(' --export <file> (Optional) Exports the configuration to a file' . PHP_EOL); print(' --export <file> (Optional) Exports the configuration to a file' . PHP_EOL);
print(' --import <file> (Optional) Imports the configuration from a file' . PHP_EOL); print(' --import <file> (Optional) Imports the configuration from a file' . PHP_EOL);
print(' --path (Optional) Displays the configuration storage path' . PHP_EOL);
print(' --nc (Optional) Disables type casting (eg; \'true\' > True) will always be a string' . PHP_EOL); print(' --nc (Optional) Disables type casting (eg; \'true\' > True) will always be a string' . PHP_EOL);
print('Examples:' . PHP_EOL . PHP_EOL); print('Examples:' . PHP_EOL . PHP_EOL);
@ -163,6 +171,7 @@
print(' configlib --conf test --editor nano Edit the configuration' . PHP_EOL); print(' configlib --conf test --editor nano Edit the configuration' . PHP_EOL);
print(' configlib --conf test --export out.json Export the configuration' . PHP_EOL); print(' configlib --conf test --export out.json Export the configuration' . PHP_EOL);
print(' configlib --conf test --import in.json Import a configuration' . PHP_EOL); print(' configlib --conf test --import in.json Import a configuration' . PHP_EOL);
print(' configlib --conf test --path Displays the configuration storage path' . PHP_EOL);
exit(0); exit(0);
} }