Remove proboctl internal admin CLI
The set-branding functionality it provided is no longer needed. Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
@@ -1,71 +0,0 @@
|
||||
// Copyright (c) 2026 Probo Inc <hello@getprobo.com>.
|
||||
//
|
||||
// Permission to use, copy, modify, and/or distribute this software for any
|
||||
// purpose with or without fee is hereby granted, provided that the above
|
||||
// copyright notice and this permission notice appear in all copies.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
// AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
// OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
// PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
package cookiebanner
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"go.gearno.de/kit/pg"
|
||||
"go.probo.inc/probo/pkg/cookiebanner"
|
||||
"go.probo.inc/probo/pkg/gid"
|
||||
)
|
||||
|
||||
type pgClientFactory func() (*pg.Client, error)
|
||||
|
||||
func NewCmdCookieBanner(newPG pgClientFactory) *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "cookie-banner <command>",
|
||||
Short: "Manage cookie banners",
|
||||
}
|
||||
|
||||
cmd.AddCommand(newCmdSetBranding(newPG))
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
func newCmdSetBranding(newPG pgClientFactory) *cobra.Command {
|
||||
return &cobra.Command{
|
||||
Use: "set-branding <banner-id> <true|false>",
|
||||
Short: "Enable or disable 'Powered by Probo' branding on a banner",
|
||||
Args: cobra.ExactArgs(2),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
bannerID, err := gid.ParseGID(args[0])
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid banner ID: %w", err)
|
||||
}
|
||||
|
||||
show, err := strconv.ParseBool(args[1])
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid boolean value %q: use true or false", args[1])
|
||||
}
|
||||
|
||||
pgClient, err := newPG()
|
||||
if err != nil {
|
||||
return fmt.Errorf("cannot connect to database: %w", err)
|
||||
}
|
||||
defer pgClient.Close()
|
||||
|
||||
svc := cookiebanner.NewService(pgClient)
|
||||
if err := svc.SetShowBranding(cmd.Context(), bannerID, show); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
fmt.Fprintf(cmd.OutOrStdout(), "show_branding set to %v for banner %s\n", show, bannerID)
|
||||
return nil
|
||||
},
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user