cmd: add option to get and set policy directly from database (#2765)

This commit is contained in:
Kristoffer Dalby 2025-09-12 16:55:15 +02:00 committed by GitHub
parent 2938d03878
commit 2b30a15a68
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 365 additions and 126 deletions

View file

@ -6,8 +6,8 @@ import (
"net/url"
"strconv"
survey "github.com/AlecAivazis/survey/v2"
v1 "github.com/juanfont/headscale/gen/go/headscale/v1"
"github.com/juanfont/headscale/hscontrol/util"
"github.com/pterm/pterm"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
@ -161,16 +161,10 @@ var destroyUserCmd = &cobra.Command{
confirm := false
force, _ := cmd.Flags().GetBool("force")
if !force {
prompt := &survey.Confirm{
Message: fmt.Sprintf(
"Do you want to remove the user %q (%d) and any associated preauthkeys?",
user.GetName(), user.GetId(),
),
}
err := survey.AskOne(prompt, &confirm)
if err != nil {
return
}
confirm = util.YesNo(fmt.Sprintf(
"Do you want to remove the user %q (%d) and any associated preauthkeys?",
user.GetName(), user.GetId(),
))
}
if confirm || force {