diff options
author | skjnldsv <skjnldsv@protonmail.com> | 2024-11-15 15:59:55 +0100 |
---|---|---|
committer | skjnldsv <skjnldsv@protonmail.com> | 2024-12-06 10:19:42 +0100 |
commit | 0c7e2591517818862f6021c8e66a44f5b84d6a65 (patch) | |
tree | 2ffeb47a1b56be9387a9f9dd1b4f140fca51781b /core | |
parent | 4af365de733a92f3fdf157e0ff1ad2d0aa4893f1 (diff) | |
download | nextcloud-server-0c7e2591517818862f6021c8e66a44f5b84d6a65.tar.gz nextcloud-server-0c7e2591517818862f6021c8e66a44f5b84d6a65.zip |
feat(systemtags): allow setting color with occ
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
Diffstat (limited to 'core')
-rw-r--r-- | core/Command/SystemTag/Edit.php | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/core/Command/SystemTag/Edit.php b/core/Command/SystemTag/Edit.php index eb6412b7639..614f2798ce4 100644 --- a/core/Command/SystemTag/Edit.php +++ b/core/Command/SystemTag/Edit.php @@ -40,6 +40,12 @@ class Edit extends Base { null, InputOption::VALUE_OPTIONAL, 'sets the access control level (public, restricted, invisible)', + ) + ->addOption( + 'color', + null, + InputOption::VALUE_OPTIONAL, + 'set the tag color', ); } @@ -80,9 +86,24 @@ class Edit extends Base { } } + $color = $tag->getColor(); + if ($input->hasOption('color')) { + $color = $input->getOption('color'); + if (substr($color, 0, 1) === '#') { + $color = substr($color, 1); + } + + if ($input->getOption('color') === '') { + $color = null; + } elseif (strlen($color) !== 6 || !ctype_xdigit($color)) { + $output->writeln('<error>Color must be a 6-digit hexadecimal value</error>'); + return 2; + } + } + try { - $this->systemTagManager->updateTag($input->getArgument('id'), $name, $userVisible, $userAssignable); - $output->writeln('<info>Tag updated ("' . $name . '", ' . $userVisible . ', ' . $userAssignable . ')</info>'); + $this->systemTagManager->updateTag($input->getArgument('id'), $name, $userVisible, $userAssignable, $color); + $output->writeln('<info>Tag updated ("' . $name . '", ' . json_encode($userVisible) . ', ' . json_encode($userAssignable) . ', "' . ($color ? "#$color" : '') . '")</info>'); return 0; } catch (TagNotFoundException $e) { $output->writeln('<error>Tag not found</error>'); |