diff --git a/autocomplete/fish_autocomplete b/autocomplete/fish_autocomplete index 1161da58..44fb2e84 100644 --- a/autocomplete/fish_autocomplete +++ b/autocomplete/fish_autocomplete @@ -87,6 +87,7 @@ complete -c lk -n '__fish_seen_subcommand_from agent a; and __fish_seen_subcomma complete -c lk -n '__fish_seen_subcommand_from agent a; and __fish_seen_subcommand_from deploy' -f -l ignore-empty-secrets -d 'If set, will skip environment variables with empty values from secrets files instead of failing' complete -c lk -n '__fish_seen_subcommand_from agent a; and __fish_seen_subcommand_from deploy' -f -l image -r -d 'Pre-built image from the local Docker daemon (e.g. myimage:latest). Requires Docker.' complete -c lk -n '__fish_seen_subcommand_from agent a; and __fish_seen_subcommand_from deploy' -f -l image-tar -r -d 'Pre-built image from an OCI tar file (e.g. ./image.tar). No Docker daemon required.' +complete -c lk -n '__fish_seen_subcommand_from agent a; and __fish_seen_subcommand_from deploy' -f -l id -r -d '`ID` of the agent. If unset, and the livekit.toml file is present, will use the id found there.' complete -c lk -n '__fish_seen_subcommand_from agent a; and __fish_seen_subcommand_from deploy' -f -l help -s h -d 'show help' complete -x -c lk -n '__fish_seen_subcommand_from agent a; and __fish_seen_subcommand_from deploy; and not __fish_seen_subcommand_from help h' -a 'help' -d 'Shows a list of commands or help for one command' complete -x -c lk -n '__fish_seen_subcommand_from agent a; and not __fish_seen_subcommand_from init create dockerfile config deploy status update restart rollback logs tail delete destroy versions list secrets update-secrets private-link start dev console daemon simulate help h' -a 'status' -d 'Get the status of an agent' diff --git a/cmd/lk/agent.go b/cmd/lk/agent.go index a61f6cb5..14f9ca74 100644 --- a/cmd/lk/agent.go +++ b/cmd/lk/agent.go @@ -229,6 +229,7 @@ var ( skipSDKCheckFlag, agentPrebuiltImageFlag, agentPrebuiltImageTarFlag, + idFlag(false), }, // NOTE: since secrets may contain commas, or indeed any special character we might want to treat as a flag separator, // we disable it entirely here and require multiple --secrets flags to be used. diff --git a/cmd/lk/agent_test.go b/cmd/lk/agent_test.go index 1d2551f6..4c21c577 100644 --- a/cmd/lk/agent_test.go +++ b/cmd/lk/agent_test.go @@ -398,6 +398,29 @@ func TestQuietFlagAlias(t *testing.T) { // "Skipped N empty secret(s)" breadcrumb) is suppressed when the Printer is quiet, and // that the --silent alias drives the same suppression as --quiet — end to end through the // real global flag and the Printer, with no code in requireSecrets checking the flag. +func TestAgentDeployRegistersIDFlag(t *testing.T) { + var deploy *cli.Command + for _, cmd := range AgentCommands { + if cmd.Name != "agent" { + continue + } + for _, sub := range cmd.Commands { + if sub.Name == "deploy" { + deploy = sub + break + } + } + } + require.NotNil(t, deploy, "deploy command should be registered") + + for _, flag := range deploy.Flags { + if flag.Names()[0] == "id" { + return + } + } + t.Fatalf("deploy command should register --id flag") +} + func TestRequireSecrets_QuietSuppressesStatus(t *testing.T) { tests := []struct { name string