Add group commands
This commit is contained in:
parent
dda2a7b4ae
commit
680daec300
11
Makefile
11
Makefile
@ -1,13 +1,18 @@
|
||||
.PHONY: help all phar
|
||||
.PHONY: help all phar deb
|
||||
|
||||
help:
|
||||
@echo "\e[1mTargets:\e[0m"
|
||||
@echo " \e[3mall\e[0m — build everything\n \e[3mphar\e[0m — build the phar"
|
||||
@echo " \e[3mall\e[0m — build everything\n \e[3mphar\e[0m — build the phar\n \e[3mdeb\e[0m — build deb package"
|
||||
|
||||
all: phar
|
||||
|
||||
phar:
|
||||
box compile
|
||||
echo "<?php return [ 'version' => '$(shell git describe --tags)', 'builddate' => '$(shell date)' ];" > src/build.php \
|
||||
&& box compile \
|
||||
&& echo "yay"
|
||||
rm -f src/build.php
|
||||
mv bin/slotcli.phar ./slotcli.phar
|
||||
|
||||
deb:
|
||||
dpack build --type deb
|
||||
|
||||
|
4
composer.lock
generated
4
composer.lock
generated
@ -594,7 +594,7 @@
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "../slotdb-client-php",
|
||||
"reference": "43d5db56cfc22486b00415079664b5fbc2392b4e"
|
||||
"reference": "f3d6e3e7b3a8daa3111e27407f13ba8c56bf997f"
|
||||
},
|
||||
"require": {
|
||||
"psr/http-client": "^1.0"
|
||||
@ -620,7 +620,7 @@
|
||||
}
|
||||
],
|
||||
"description": "SlotDB PHP Client",
|
||||
"time": "2025-03-13T16:14:01+00:00"
|
||||
"time": "2025-03-13T18:11:29+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/console",
|
||||
|
22
distropack.yaml
Normal file
22
distropack.yaml
Normal file
@ -0,0 +1,22 @@
|
||||
dpack:
|
||||
version: '1.0'
|
||||
package:
|
||||
package: slotdb-cli
|
||||
priority: optional
|
||||
section: misc
|
||||
maintainer: 'NoccyLabs <labs@noccy.com>'
|
||||
architecture: all
|
||||
version:
|
||||
from: git-tag
|
||||
depends: [ php-cli ]
|
||||
summary: 'A database to manage properties on a fixed set of slots (CLI utility)'
|
||||
description: Experimental.
|
||||
files:
|
||||
./slotcli.phar:
|
||||
target: /usr/bin/slotcli
|
||||
chmod: '0744'
|
||||
build:
|
||||
- 'make phar'
|
||||
./doc/slotcli.1.md:
|
||||
target: /usr/share/man/man1/slotcli.1.gz
|
||||
type: manpage
|
32
doc/slotcli.1.md
Normal file
32
doc/slotcli.1.md
Normal file
@ -0,0 +1,32 @@
|
||||
% slotcli(1) 1.0.0 | slotcli 0.1.0
|
||||
% Christopher Vagnetoft <labs@noccy.com>
|
||||
% January 2025
|
||||
|
||||
# NAME
|
||||
slotcli - SlotDB database daemon CLI utility
|
||||
|
||||
# SYNOPSIS
|
||||
**slotcli** [*OPTIONS*]\
|
||||
**slotcli** \-h
|
||||
|
||||
# DESCRIPTION
|
||||
**slotcli** is a CLI for SlotDB
|
||||
|
||||
# OPTIONS
|
||||
**\-h**, **\-\-help**
|
||||
: Display help
|
||||
|
||||
|
||||
# EXAMPLES
|
||||
**slotcli**
|
||||
: Show available commands
|
||||
|
||||
# EXIT VALUES
|
||||
**0**
|
||||
: Success
|
||||
|
||||
# BUGS
|
||||
Probably
|
||||
|
||||
# COPYRIGHT
|
||||
Copyright (c) 2025, NoccyLabs. Licensed under GPL version 3 or later.
|
@ -20,6 +20,9 @@ class Application extends \Symfony\Component\Console\Application
|
||||
$this->add(new Command\Slot\SlotQueryCommand($client));
|
||||
$this->add(new Command\Slot\SlotFindCommand($client));
|
||||
$this->add(new Command\Slot\SlotSetCommand($client));
|
||||
|
||||
$this->add(new Command\Group\GroupFindCommand($client));
|
||||
$this->add(new Command\Group\GroupShowCommand($client));
|
||||
}
|
||||
|
||||
}
|
||||
|
37
src/Command/Group/GroupFindCommand.php
Normal file
37
src/Command/Group/GroupFindCommand.php
Normal file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace SlotDb\Cli\Command\Group;
|
||||
|
||||
use SlotDb\Client\SlotDbClient;
|
||||
use Symfony\Component\Console\Attribute\AsCommand;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Helper\Table;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
#[AsCommand(name:"group:find", aliases:[ "groups" ], description:"Find all groups")]
|
||||
class GroupFindCommand extends Command
|
||||
{
|
||||
public function __construct(
|
||||
private readonly SlotDbClient $client
|
||||
)
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
protected function configure()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
|
||||
$groups = $this->client->findGroups();
|
||||
|
||||
var_dump($groups);
|
||||
|
||||
return self::SUCCESS;
|
||||
}
|
||||
}
|
37
src/Command/Group/GroupShowCommand.php
Normal file
37
src/Command/Group/GroupShowCommand.php
Normal file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace SlotDb\Cli\Command\Group;
|
||||
|
||||
use SlotDb\Client\SlotDbClient;
|
||||
use Symfony\Component\Console\Attribute\AsCommand;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Helper\Table;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
#[AsCommand(name:"group:show", description:"Show slots in a group")]
|
||||
class GroupShowCommand extends Command
|
||||
{
|
||||
public function __construct(
|
||||
private readonly SlotDbClient $client
|
||||
)
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
protected function configure()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
|
||||
$groups = $this->client->findGroups();
|
||||
|
||||
var_dump($groups);
|
||||
|
||||
return self::SUCCESS;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user