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:
@ -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));
|
||||
|
Reference in New Issue
Block a user