cmd

package
v1.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 31, 2025 License: Apache-2.0 Imports: 38 Imported by: 0

Documentation

Overview

Copyright © 2024 NAME HERE <EMAIL ADDRESS>

Index

Constants

This section is empty.

Variables

View Source
var (
	GroupCore = &cobra.Group{
		ID:    "core",
		Title: "Core",
	}
	GroupAuth = &cobra.Group{
		ID:    "auth",
		Title: "Auth",
	}
	GroupSession = &cobra.Group{
		ID:    "session",
		Title: "Session",
	}
	GroupManagement = &cobra.Group{
		ID:    "management",
		Title: "Management",
	}

	AllGroups = []*cobra.Group{
		GroupCore,
		GroupAuth,
		GroupSession,
		GroupManagement,
	}
)
View Source
var InteractiveDeployCancel = func(ctx context.Context, input views.DeployCancelInput, breadcrumb string) tea.Cmd {
	return command.AddToStackFunc(ctx, deployCancelCmd, breadcrumb, &input, views.NewDeployCancelView(ctx, input))
}
View Source
var InteractiveDeployCreate = func(ctx context.Context, input types.DeployInput, breadcrumb string) tea.Cmd {
	return command.AddToStackFunc(
		ctx,
		deployCreateCmd,
		breadcrumb,
		&input,
		views.NewDeployCreateView(ctx, input, func(d *client.Deploy) tea.Cmd {
			return TailResourceLogs(ctx, input.ServiceID)
		}))
}
View Source
var InteractiveDeployList = func(ctx context.Context, input views.DeployListInput, r resource.Resource, breadcrumb string) tea.Cmd {
	return command.AddToStackFunc(ctx, deployListCmd, breadcrumb, &input, views.NewDeployListView(
		ctx,
		input,
		func(c *client.Deploy) tea.Cmd {
			return InteractivePalette(ctx, commandsForDeploy(c, r.ID(), r.Type()), c.Id)
		},
	))
}
View Source
var InteractiveEnvironment = func(ctx context.Context, input views.EnvironmentInput, breadcrumb string) tea.Cmd {
	return command.AddToStackFunc(ctx, environmentCmd, breadcrumb, &input, views.NewEnvironmentList(ctx, input,
		func(ctx context.Context, e *client.Environment) tea.Cmd {
			return InteractiveServices(ctx, views.ListResourceInput{
				EnvironmentIDs: []string{e.Id},
			}, e.Name)
		},
		tui.WithCustomOptions[*client.Environment]([]tui.CustomOption{
			WithCopyID(ctx, servicesCmd),
			WithWorkspaceSelection(ctx),
		}),
	))
}
View Source
var InteractiveJobCancel = func(ctx context.Context, input views.JobCancelInput, breadcrumb string) tea.Cmd {
	return command.AddToStackFunc(ctx, jobCancelCmd, breadcrumb, &input, views.NewJobCancelView(ctx, input))
}
View Source
var InteractiveJobCreate = func(ctx context.Context, input *views.JobCreateInput, breadcrumb string) tea.Cmd {
	return command.AddToStackFunc(
		ctx,
		JobCreateCmd,
		breadcrumb,
		input,
		views.NewJobCreateView(ctx, input, JobCreateCmd, views.CreateJob, func(j *clientjob.Job) tea.Cmd {
			return InteractiveLogs(ctx, views.LogInput{
				ResourceIDs: []string{j.Id},
				Tail:        true,
			}, "Logs")
		}),
	)
}
View Source
var InteractiveJobList = func(ctx context.Context, input views.JobListInput, breadcrumb string) tea.Cmd {
	return command.AddToStackFunc(ctx, jobListCmd, breadcrumb, &views.ProjectInput{}, views.NewJobListView(ctx,
		&input,
		func(j *clientjob.Job) tea.Cmd {
			return InteractivePalette(ctx, commandsForJob(j), j.Id)
		},
	))
}
View Source
var InteractiveProjectList = func(ctx context.Context) {
	command.AddToStackFunc(
		ctx,
		projectCmd,
		"Projects",
		&views.ProjectInput{},
		views.NewProjectList(ctx,
			func(ctx context.Context, p *client.Project) tea.Cmd {
				return InteractiveEnvironment(ctx, views.EnvironmentInput{
					ProjectID: p.Id,
				}, p.Name)
			},
			tui.WithCustomOptions[*client.Project]([]tui.CustomOption{
				WithCopyID(ctx, servicesCmd),
				WithWorkspaceSelection(ctx),
			}),
		))
}
View Source
var InteractiveRestart = func(ctx context.Context, input views.RestartInput, breadcrumb string) tea.Cmd {
	return command.AddToStackFunc(ctx, restartCmd, breadcrumb, &input, views.NewRestartView(ctx, input, func() tea.Cmd {
		return TailResourceLogs(ctx, input.ResourceID)
	}))
}
View Source
var InteractiveWorkspaceSet = func(ctx context.Context, in views.ListWorkspaceInput) tea.Cmd {
	return command.AddToStackFunc(ctx, workspaceSetCmd, "Set Workspace", &in, views.NewWorkspaceView(ctx, in))
}
View Source
var JobCreateCmd = &cobra.Command{
	Use:   "create [serviceID]",
	Short: "Create a new job for a service",
	Args:  cobra.MaximumNArgs(1),
}
View Source
var LogsCmd = &cobra.Command{
	Use:   "logs",
	Short: "View logs for services and datastores",
	Long: `View logs for services and datastores.

Use flags to filter logs by resource, instance, time, text, level, type, host, status code, method, or path.
Unlike in the dashboard, you can view logs for multiple resources at once. Set --tail=true to stream new logs (currently only in interactive mode).

In interactive mode you can update the filters and view logs in real time.`,
	GroupID: GroupCore.ID,
}
View Source
var RootCmd = rootCmd

RootCmd is set to export the root command for use in tests

Functions

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

func InteractiveLogs

func InteractiveLogs(ctx context.Context, input views.LogInput, breadcrumb string) tea.Cmd

func InteractivePGCLIView

func InteractivePGCLIView(ctx context.Context, input *views.PSQLInput) tea.Cmd

func InteractivePSQLView

func InteractivePSQLView(ctx context.Context, input *views.PSQLInput) tea.Cmd

func InteractivePalette

func InteractivePalette(ctx context.Context, commands []views.PaletteCommand, breadcrumb string) tea.Cmd

func InteractiveRedisView

func InteractiveRedisView(ctx context.Context, input *views.RedisCLIInput) tea.Cmd

func InteractiveSSHView

func InteractiveSSHView(ctx context.Context, input *views.SSHInput, breadcrumb string) tea.Cmd

func InteractiveServices

func InteractiveServices(ctx context.Context, in views.ListResourceInput, breadcrumb string) tea.Cmd

func TailResourceLogs

func TailResourceLogs(ctx context.Context, resourceID string) tea.Cmd

func WithCopyID

func WithCopyID(ctx context.Context, cmd *cobra.Command) tui.CustomOption

func WithProjectFilter

func WithProjectFilter(ctx context.Context, cmd *cobra.Command, breadcrumb string, in any, h ProjectHandler) tui.CustomOption

func WithWorkspaceSelection

func WithWorkspaceSelection(ctx context.Context) tui.CustomOption

Types

type ProjectHandler

type ProjectHandler func(ctx context.Context, project *client.Project) tea.Cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL