cli icon indicating copy to clipboard operation
cli copied to clipboard

add command to list all commands unformated

Open bnomei opened this issue 3 years ago • 2 comments

not like in help but just one item per line. why?

that can be used in further automations like fig.

CleanShot 2022-12-21 at 10 57 53@2x

bnomei avatar Dec 21 '22 11:12 bnomei

if you want to go deeper down the rabbit hole you could also create an publish a script to take care of that. https://fig.io/docs/getting-started

sadly there is no parser for PHP available yet so its manual work.

bnomei avatar Dec 21 '22 11:12 bnomei

i created one myself kirby make:command commands --global

<?php

declare(strict_types = 1);

use Kirby\CLI\CLI;

return [
	'description' => 'All commands',
	'command' => static function (CLI $cli): void {
		$commands = $cli->commands();

		foreach ($commands['core'] as $command) {
			$cli->out($command);
		}

		if (count($commands['global']) > 0) {
			foreach ($commands['global'] as $command) {
				$cli->out($command);
			}
		}

		if (count($commands['custom']) > 0) {
			foreach ($commands['custom'] as $command) {
				$cli->out($command);
			}
		}

		if (count($commands['plugins']) > 0) {
			foreach ($commands['plugins'] as $command) {
				$cli->out($command);
			}
		}
	}
];

but it would be nice to have this out-of-the-box

bnomei avatar Dec 21 '22 11:12 bnomei