Implement stow config file and folder unwrapping

Move includes to their own folder, config.php will otherwise be included
and cleans up nicely
This commit is contained in:
Tim
2025-05-19 00:26:52 +02:00
parent b7e5ee3b0e
commit 90751f5bec
8 changed files with 31 additions and 24 deletions

View File

@ -1,10 +1,10 @@
#!/usr/bin/env php
<?php
require_once __DIR__ . '/../argvParser.php';
require_once __DIR__ . '/../functions.php';
require_once __DIR__ . '/../snips.php';
require_once __DIR__ . '/../config.php';
require_once __DIR__ . '/../includes/argvParser.php';
require_once __DIR__ . '/../includes/functions.php';
require_once __DIR__ . '/../includes/snips.php';
require_once __DIR__ . '/../includes/config.php';
$config = new homeConfig('snips');
$argvParser = new argvParser(['f' => 'File', 'a' => 'Api key', 's' => 'Shortcut'], ['c' => 'Command', 'id' => 'Snip id']);
@ -17,13 +17,10 @@ if ($parsed === false) {
$command = $parsed->get('c');
$id = $parsed->get('id');
$file = $parsed->get('f');
$apiKey = $parsed->get('k');
$apiKey = $parsed->get('k', $config->get('apiKey'));
$getShortcut = $parsed->get('s');
$content = $parsed->getRest();
if (empty($apiKey)) {
$apiKey = $config->get('apiKey');
}
if (empty($apiKey)) {
line('Input api key:');
$apiKey = trim(fgets(STDIN));