1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-06 13:16:45 +02:00

feat(console): finetune console

This commit is contained in:
Awilum
2022-07-02 12:32:12 +03:00
parent 416535629a
commit 34bcde5c6a
24 changed files with 108 additions and 107 deletions

View File

@@ -39,16 +39,16 @@ class CacheClearCommand extends Command
if (filesystem()->directory($path)->delete()) {
$output->write(
renderToString(
div('Success: All items were successfully cleared from the cache.',
'bg-success px-2 py-1')
div('All items were successfully cleared from the cache.',
'color-success px-2 py-1')
)
);
$result = Command::SUCCESS;
} else {
$output->write(
renderToString(
div('Failure: Cache wasn\'t cleared.',
'bg-danger px-2 py-1')
div('Cache wasn\'t cleared.',
'color-danger px-2 py-1')
)
);
$result = Command::FAILURE;
@@ -56,8 +56,8 @@ class CacheClearCommand extends Command
} else {
$output->write(
renderToString(
div('Failure: Cache directory ' . $path . ' doesn\'t exist.',
'bg-danger px-2 py-1')
div('Cache directory ' . $path . ' doesn\'t exist.',
'color-danger px-2 py-1')
)
);
$result = Command::FAILURE;

View File

@@ -39,16 +39,16 @@ class CacheClearConfigCommand extends Command
if (filesystem()->directory($configPath)->delete()) {
$output->write(
renderToString(
div('Success: Config were successfully cleared from the cache.',
'bg-success px-2 py-1')
div('Config were successfully cleared from the cache.',
'color-success px-2 py-1')
)
);
$result = Command::SUCCESS;
} else {
$output->write(
renderToString(
div('Failure: Config cache wasn\'t cleared.',
'bg-danger px-2 py-1')
div('Config cache wasn\'t cleared.',
'color-danger px-2 py-1')
)
);
$result = Command::FAILURE;
@@ -56,8 +56,8 @@ class CacheClearConfigCommand extends Command
} else {
$output->write(
renderToString(
div('Failure: Config cache directory ' . $configPath . ' doesn\'t exist.',
'bg-danger px-2 py-1')
div('Config cache directory ' . $configPath . ' doesn\'t exist.',
'color-danger px-2 py-1')
)
);
$result = Command::FAILURE;

View File

@@ -42,16 +42,16 @@ class CacheClearDataCommand extends Command
if (filesystem()->directory($routesData)->delete()) {
$output->write(
renderToString(
div('Success: Data were successfully cleared from the cache.',
'bg-success px-2 py-1')
div('Data were successfully cleared from the cache.',
'color-success px-2 py-1')
)
);
$result = Command::SUCCESS;
} else {
$output->write(
renderToString(
div('Failure: Data cache wasn\'t cleared.',
'bg-danger px-2 py-1')
div('Data cache wasn\'t cleared.',
'color-danger px-2 py-1')
)
);
$result = Command::FAILURE;
@@ -59,8 +59,8 @@ class CacheClearDataCommand extends Command
} else {
$output->write(
renderToString(
div('Failure: Data cache directory ' . $routesData . ' doesn\'t exist.',
'bg-danger px-2 py-1')
div('Data cache directory ' . $routesData . ' doesn\'t exist.',
'color-danger px-2 py-1')
)
);
$result = Command::FAILURE;

View File

@@ -42,16 +42,16 @@ class CacheClearRoutesCommand extends Command
if (filesystem()->directory($routesPath)->delete()) {
$output->write(
renderToString(
div('Success: Routes were successfully cleared from the cache.',
'bg-success px-2 py-1')
div('Routes were successfully cleared from the cache.',
'color-success px-2 py-1')
)
);
$result = Command::SUCCESS;
} else {
$output->write(
renderToString(
div('Failure: Routes cache wasn\'t cleared.',
'bg-danger px-2 py-1')
div('Routes cache wasn\'t cleared.',
'color-danger px-2 py-1')
)
);
$result = Command::FAILURE;
@@ -59,8 +59,8 @@ class CacheClearRoutesCommand extends Command
} else {
$output->write(
renderToString(
div('Failure: Routes cache directory ' . $routesPath . ' doesn\'t exist.',
'bg-danger px-2 py-1')
div('Routes cache directory ' . $routesPath . ' doesn\'t exist.',
'color-danger px-2 py-1')
)
);
$result = Command::FAILURE;

View File

@@ -39,16 +39,16 @@ class CacheDeleteCommand extends Command
if (cache()->delete($key)) {
$output->write(
renderToString(
div('Success: Cache item with key ' . $key . ' deleted.',
'bg-success px-2 py-1')
div('Cache item with key ' . $key . ' deleted.',
'color-success px-2 py-1')
)
);
return Command::SUCCESS;
} else {
$output->write(
renderToString(
div('Failure: Cache item with key ' . $key . ' wasn\'t deleted.',
'bg-danger px-2 py-1')
div('Cache item with key ' . $key . ' wasn\'t deleted.',
'color-danger px-2 py-1')
)
);
return Command::FAILURE;

View File

@@ -44,7 +44,7 @@ class CacheDeleteMultipleCommand extends Command
$output->write(
renderToString(
div('Cache items with keys [b]' . implode('[/b], [b]', $keys) . '[/b] deleted.',
'bg-success px-2 py-1')
'color-success px-2 py-1')
)
);
return Command::SUCCESS;
@@ -52,7 +52,7 @@ class CacheDeleteMultipleCommand extends Command
$output->write(
renderToString(
div('Cache items with keys [b]' . implode('[/b], [b]', $keys) . '[/b] wasn\'t deleted.',
'bg-danger px-2 py-1')
'color-danger px-2 py-1')
)
);
return Command::FAILURE;

View File

@@ -39,16 +39,16 @@ class CacheHasCommand extends Command
if (cache()->has($key)) {
$output->write(
renderToString(
div('Success: Cache item with key [b]' . $key . '[/b] exists.',
'bg-success px-2 py-1')
div('Cache item with key [b]' . $key . '[/b] exists.',
'color-success px-2 py-1')
)
);
return Command::SUCCESS;
} else {
$output->write(
renderToString(
div('Failure: Cache item with key [b]' . $key . '[/b] doesn\'t exists.',
'bg-success px-2 py-1')
div('Cache item with key [b]' . $key . '[/b] doesn\'t exists.',
'color-success px-2 py-1')
)
);
return Command::FAILURE;

View File

@@ -43,16 +43,16 @@ class CacheSetCommand extends Command
if (cache()->set($key, $value, $ttl)) {
$output->write(
renderToString(
div('Success: Cache item with key ' . $key . ' created.',
'bg-success px-2 py-1')
div('Cache item with key ' . $key . ' created.',
'color-success px-2 py-1')
)
);
return Command::SUCCESS;
} else {
$output->write(
renderToString(
div('Failure: Cache item with key ' . $key . ' wasn\'t created.',
'bg-danger px-2 py-1')
div('Cache item with key ' . $key . ' wasn\'t created.',
'color-danger px-2 py-1')
)
);
return Command::FAILURE;

View File

@@ -46,16 +46,16 @@ class CacheSetMultipleCommand extends Command
if (cache()->setMultiple($values, $ttl)) {
$output->write(
renderToString(
div('Success: Cache items with keys [b]' . implode('[/b], [b]', array_keys($values)) . '[/b] created.',
'bg-success px-2 py-1')
div('Cache items with keys [b]' . implode('[/b], [b]', array_keys($values)) . '[/b] created.',
'color-success px-2 py-1')
)
);
return Command::SUCCESS;
} else {
$output->write(
renderToString(
div('Failure: Cache items with keys [b]' . implode('[/b], [b]', array_keys($values)) . '[/b] wasn\'t created.',
'bg-success px-2 py-1')
div('Cache items with keys [b]' . implode('[/b], [b]', array_keys($values)) . '[/b] wasn\'t created.',
'color-success px-2 py-1')
)
);
return Command::FAILURE;

View File

@@ -42,8 +42,8 @@ class EntriesCopyCommand extends Command
if (! entries()->has($id)) {
$output->write(
renderToString(
div('Failure: Entry [b]' . $id . '[/b] doesn\'t exists.',
'bg-danger px-2 py-1')
div('Entry [b]' . $id . '[/b] doesn\'t exists.',
'color-danger px-2 py-1')
)
);
return Command::FAILURE;
@@ -52,16 +52,16 @@ class EntriesCopyCommand extends Command
if (entries()->copy($id, $newID)) {
$output->write(
renderToString(
div('Success: Entry [b]' . $id . '[/b] coppied to [b]' . $newID . '[/b]',
'bg-success px-2 py-1')
div('Entry [b]' . $id . '[/b] coppied to [b]' . $newID . '[/b]',
'color-success px-2 py-1')
)
);
return Command::SUCCESS;
} else {
$output->write(
renderToString(
div('Failure: Entry [b]' . $id . '[/b] wasn\'t coppied to [b]' . $newID . '[/b]',
'bg-success px-2 py-1')
div('Entry [b]' . $id . '[/b] wasn\'t coppied to [b]' . $newID . '[/b]',
'color-success px-2 py-1')
)
);
return Command::FAILURE;

View File

@@ -51,16 +51,16 @@ class EntriesCreateCommand extends Command
if (entries()->create($id, $dataToSave)) {
$output->write(
renderToString(
div('Success: Entry [b]' . $id . '[/b] created.',
'bg-success px-2 py-1')
div('Entry [b]' . $id . '[/b] created.',
'color-success px-2 py-1')
)
);
return Command::SUCCESS;
} else {
$output->write(
renderToString(
div('Failure: Entry [b]' . $id . '[/b] wasn\'t created.',
'bg-danger px-2 py-1')
div('Entry [b]' . $id . '[/b] wasn\'t created.',
'color-danger px-2 py-1')
)
);
return Command::FAILURE;

View File

@@ -39,8 +39,8 @@ class EntriesDeleteCommand extends Command
if (! entries()->has($id)) {
$output->write(
renderToString(
div('Failure: Entry [b]' . $id . '[/b] doesn\'t exists.',
'bg-danger px-2 py-1')
div('Entry [b]' . $id . '[/b] doesn\'t exists.',
'color-danger px-2 py-1')
)
);
return Command::FAILURE;
@@ -49,16 +49,16 @@ class EntriesDeleteCommand extends Command
if (entries()->delete($id)) {
$output->write(
renderToString(
div('Success: Entry [b]' . $id . '[/b] deleted.',
'bg-success px-2 py-1')
div('Entry [b]' . $id . '[/b] deleted.',
'color-success px-2 py-1')
)
);
return Command::SUCCESS;
} else {
$output->write(
renderToString(
div('Failure: Entry [b]' . $id . '[/b] wasn\'t deleted.',
'bg-danger px-2 py-1')
div('Entry [b]' . $id . '[/b] wasn\'t deleted.',
'color-danger px-2 py-1')
)
);
return Command::FAILURE;

View File

@@ -151,8 +151,8 @@ class EntriesFetchCommand extends Command
} else {
$output->write(
renderToString(
div('Failure: Entry [b]' . $id . '[/b] doesn\'t exists.',
'bg-danger px-2 py-1')
div('Entry [b]' . $id . '[/b] doesn\'t exists.',
'color-danger px-2 py-1')
)
);
return Command::FAILURE;

View File

@@ -40,16 +40,16 @@ class EntriesHasCommand extends Command
if (entries()->has($id)) {
$output->write(
renderToString(
div('Success: Entry [b]' . $id . '[/b] exists.',
'bg-success px-2 py-1')
div('Entry [b]' . $id . '[/b] exists.',
'color-success px-2 py-1')
)
);
return Command::SUCCESS;
} else {
$output->write(
renderToString(
div('Failure: Entry [b]' . $id . '[/b] doesn\'t exists.',
'bg-danger px-2 py-1')
div('Entry [b]' . $id . '[/b] doesn\'t exists.',
'color-danger px-2 py-1')
)
);
return Command::FAILURE;

View File

@@ -41,8 +41,8 @@ class EntriesMoveCommand extends Command
if (! entries()->has($id)) {
$output->write(
renderToString(
div('Failure: Entry [b]' . $id . '[/b] doesn\'t exists.',
'bg-danger px-2 py-1')
div('Entry [b]' . $id . '[/b] doesn\'t exists.',
'color-danger px-2 py-1')
)
);
return Command::FAILURE;
@@ -51,16 +51,16 @@ class EntriesMoveCommand extends Command
if (entries()->move($id, $newID)) {
$output->write(
renderToString(
div('Success: Entry [b]' . $id . '[/b] moved to [b]' . $newID . '[/b]',
'bg-success px-2 py-1')
div('Entry [b]' . $id . '[/b] moved to [b]' . $newID . '[/b]',
'color-success px-2 py-1')
)
);
return Command::SUCCESS;
} else {
$output->write(
renderToString(
div('Failure: Entry [b]' . $id . '[/b] wasn\'t moved to [b]' . $newID . '[/b]',
'bg-danger px-2 py-1')
div('Entry [b]' . $id . '[/b] wasn\'t moved to [b]' . $newID . '[/b]',
'color-danger px-2 py-1')
)
);
return Command::FAILURE;

View File

@@ -51,8 +51,8 @@ class EntriesUpdateCommand extends Command
if (! entries()->has($id)) {
$output->write(
renderToString(
div('Failure: Entry [b]' . $id . '[/b] doesn\'t exists.',
'bg-danger px-2 py-1')
div('Entry [b]' . $id . '[/b] doesn\'t exists.',
'color-danger px-2 py-1')
)
);
return Command::FAILURE;
@@ -61,16 +61,16 @@ class EntriesUpdateCommand extends Command
if (entries()->update($id, $dataToSave)) {
$output->write(
renderToString(
div('Success: Entry [b]' . $id . '[/b] updated.',
'bg-success px-2 py-1')
div('Entry [b]' . $id . '[/b] updated.',
'color-success px-2 py-1')
)
);
return Command::SUCCESS;
} else {
$output->write(
renderToString(
div('Failure: Entry [b]' . $id . '[/b] wasn\'t updated.',
'bg-danger px-2 py-1')
div('Entry [b]' . $id . '[/b] wasn\'t updated.',
'color-danger px-2 py-1')
)
);
return Command::FAILURE;

View File

@@ -55,16 +55,16 @@ class TokensCreateCommand extends Command
if (entries()->create('tokens/' . $token, array_merge($dataToSave, ['hashed_access_token' => $hashed_access_token]))) {
$output->write(
renderToString(
div('Success: Token [b]' . $token . '[/b] with secret access token [b]' . $access_token . '[/b] created.',
'bg-success px-2 py-1')
div('Token [b]' . $token . '[/b] with secret access token [b]' . $access_token . '[/b] created.',
'color-success px-2 py-1')
)
);
return Command::SUCCESS;
} else {
$output->write(
renderToString(
div('Failure: Token wasn\'t created.',
'bg-danger px-2 py-1')
div('Token wasn\'t created.',
'color-danger px-2 py-1')
)
);
return Command::FAILURE;

View File

@@ -39,8 +39,8 @@ class TokensDeleteCommand extends Command
if (! entries()->has($id)) {
$output->write(
renderToString(
div('Failure: Token entry [b]' . $id . '[/b] doesn\'t exists.',
'bg-danger px-2 py-1')
div('Token entry [b]' . $id . '[/b] doesn\'t exists.',
'color-danger px-2 py-1')
)
);
return Command::FAILURE;
@@ -49,16 +49,16 @@ class TokensDeleteCommand extends Command
if (entries()->delete($id)) {
$output->write(
renderToString(
div('Success: Token entry [b]' . $id . '[/b] deleted.',
'bg-success px-2 py-1')
div('Token entry [b]' . $id . '[/b] deleted.',
'color-success px-2 py-1')
)
);
return Command::SUCCESS;
} else {
$output->write(
renderToString(
div('Failure: Token entry [b]' . $id . '[/b] wasn\'t deleted.',
'bg-danger px-2 py-1')
div('Token entry [b]' . $id . '[/b] wasn\'t deleted.',
'color-danger px-2 py-1')
)
);
return Command::FAILURE;

View File

@@ -151,8 +151,8 @@ class TokensFetchCommand extends Command
} else {
$output->write(
renderToString(
div('Failure: Token entry [b]' . $id . '[/b] doesn\'t exists.',
'bg-danger px-2 py-1')
div('Token entry [b]' . $id . '[/b] doesn\'t exists.',
'color-danger px-2 py-1')
)
);
return Command::FAILURE;

View File

@@ -36,8 +36,8 @@ class TokensGenerateCommand extends Command
{
$output->write(
renderToString(
div('Success: Token [b]' . generateToken($input->getArgument('length') ?? 16) . '[/b] generated.',
'bg-success px-2 py-1')
div('Token [b]' . generateToken($input->getArgument('length') ?? 16) . '[/b] generated.',
'color-success px-2 py-1')
)
);

View File

@@ -38,8 +38,8 @@ class TokensGenerateHashCommand extends Command
$output->write(
renderToString(
div('Success: Hash [b]' . generateTokenHash($token) . '[/b] for token [b]' . $token . '[/b] generated.',
'bg-success px-2 py-1')
div('Hash [b]' . generateTokenHash($token) . '[/b] for token [b]' . $token . '[/b] generated.',
'color-success px-2 py-1')
)
);

View File

@@ -40,16 +40,16 @@ class TokensHasCommand extends Command
if (entries()->has($id)) {
$output->write(
renderToString(
div('Success: Token entry [b]' . $id . '[/b] exists.',
'bg-success px-2 py-1')
div('Token entry [b]' . $id . '[/b] exists.',
'color-success px-2 py-1')
)
);
return Command::SUCCESS;
} else {
$output->write(
renderToString(
div('Failure: Token entry [b]' . $id . '[/b] doesn\'t exists.',
'bg-danger px-2 py-1')
div('Token entry [b]' . $id . '[/b] doesn\'t exists.',
'color-danger px-2 py-1')
)
);
return Command::FAILURE;

View File

@@ -51,8 +51,8 @@ class TokensUpdateCommand extends Command
if (! entries()->has($id)) {
$output->write(
renderToString(
div('Failure: Token entry [b]' . $id . '[/b] doesn\'t exists.',
'bg-danger px-2 py-1')
div('Token entry [b]' . $id . '[/b] doesn\'t exists.',
'color-danger px-2 py-1')
)
);
return Command::FAILURE;
@@ -61,16 +61,16 @@ class TokensUpdateCommand extends Command
if (entries()->update($id, $dataToSave)) {
$output->write(
renderToString(
div('Success: Token entry [b]' . $id . '[/b] updated.',
'bg-success px-2 py-1')
div('Token entry [b]' . $id . '[/b] updated.',
'color-success px-2 py-1')
)
);
return Command::SUCCESS;
} else {
$output->write(
renderToString(
div('Failure: Token entry [b]' . $id . '[/b] wasn\'t updated.',
'bg-danger px-2 py-1')
div('Token entry [b]' . $id . '[/b] wasn\'t updated.',
'color-danger px-2 py-1')
)
);
return Command::FAILURE;

View File

@@ -36,11 +36,12 @@ class TokensVerifyHashCommand extends Command
protected function execute(InputInterface $input, OutputInterface $output): int
{
if (verrifyTokenHash($input->getArgument('token'), $input->getArgument('token-hash') )) {
dd($input->getArgument('token-hash'));
if (verifyTokenHash($input->getArgument('token'), $input->getArgument('token-hash'))) {
$output->write(
renderToString(
div('Success: Token [b]' . $input->getArgument('token') . ' is verified',
'bg-success px-2 py-1')
div('Token [b]' . $input->getArgument('token') . ' is verified',
'color-success px-2 py-1')
)
);
@@ -48,8 +49,8 @@ class TokensVerifyHashCommand extends Command
} else {
$output->write(
renderToString(
div('Failure: Token [b]' . $input->getArgument('token') . ' isn\'t verified',
'bg-success px-2 py-1')
div('Token [b]' . $input->getArgument('token') . ' isn\'t verified',
'color-danger px-2 py-1')
)
);