alias

package module
v0.0.0-...-30238d1 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package alias is the charly plugin housing the `charly alias …` CLI — the host command alias manager (create / install / list / remove / uninstall wrapper scripts that shell into a box). It is a dual-placement COMMAND plugin (F8): the SAME NewProvider()/NewMeta()/CliMain compile INTO charly in-process when listed in compiled_plugins (the canonical placement, P14), or cmd/serve serves them OUT-OF-PROCESS when they are not.

command:alias — `charly alias add/install/list/remove/uninstall`. COMPILED-IN, it dispatches IN-PROC via Invoke(OpRun) (runAliasCommand → kong-parse the AliasCmd tree — alias.go), so the handlers run in charly's OWN process and inherit charly's real stdio natively. The two handlers that need host image facts — `add` (does the box image exist locally) and `install` (read the baked ai.opencharly.alias label) — reach the host over the generic HostBuild("cli") reverse channel by re-running `charly box labels …` (the same seam pod/vm lifecycles use), so the plugin owns ONLY the alias-script logic and imports the sdk module alone, never charly core.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CliMain

func CliMain(_ []string) int

CliMain is the OUT-OF-PROCESS command entry — unreachable in the canonical compiled-in placement. command:alias's `add`/`install` handlers reach the host reverse channel (image-label facts), which is unavailable out-of-process, so this errors (like candy/plugin-vm's CliMain).

func NewMeta

func NewMeta() pb.PluginMetaServer

NewMeta advertises command:alias via sdk.NewMeta → BuildCapabilities so the COMPILED-IN path registers it as a command provider (the host builds its dynamic Kong grammar + dispatches Invoke(OpRun)). A command's args are pass-through CLI tokens, not a structured plugin_input, so the capability carries no InputDef and the plugin ships no schema.

func NewProvider

func NewProvider() pb.ProviderServer

NewProvider returns the alias command provider for in-proc registration (compiled-in) or out-of-proc serving.

Types

type AliasAddCmd

type AliasAddCmd struct {
	Name    string `arg:"" help:"Alias name (command on host)"`
	Box     string `arg:"" help:"Box name from charly.yml"`
	Command string `arg:"" optional:"" help:"Command inside container (default: alias name)"`
	Dest    string `long:"dest" default:"" help:"Directory for wrapper scripts (default: ~/.local/bin)"`
}

AliasAddCmd creates a single alias

func (*AliasAddCmd) Run

func (c *AliasAddCmd) Run(hc *hostClient) error

type AliasCmd

type AliasCmd struct {
	Add       AliasAddCmd       `cmd:"" help:"Create a host command alias"`
	Install   AliasInstallCmd   `cmd:"" help:"Install default aliases from the candy + box config"`
	List      AliasListCmd      `cmd:"" help:"List all installed aliases"`
	Remove    AliasRemoveCmd    `cmd:"" help:"Remove an alias"`
	Uninstall AliasUninstallCmd `cmd:"" help:"Remove all aliases for a box"`
}

AliasCmd groups alias subcommands

type AliasInfo

type AliasInfo struct {
	Name    string
	Box     string
	Command string
}

AliasInfo holds parsed metadata from a wrapper script.

type AliasInstallCmd

type AliasInstallCmd struct {
	Box  string `arg:"" help:"Box name from charly.yml"`
	Dest string `long:"dest" default:"" help:"Directory for wrapper scripts (default: ~/.local/bin)"`
}

AliasInstallCmd installs all default aliases for an image

func (*AliasInstallCmd) Run

func (c *AliasInstallCmd) Run(hc *hostClient) error

type AliasListCmd

type AliasListCmd struct {
	Dest string `long:"dest" default:"" help:"Directory for wrapper scripts (default: ~/.local/bin)"`
}

AliasListCmd lists all installed aliases

func (*AliasListCmd) Run

func (c *AliasListCmd) Run() error

type AliasRemoveCmd

type AliasRemoveCmd struct {
	Name string `arg:"" help:"Alias name to remove"`
	Dest string `long:"dest" default:"" help:"Directory for wrapper scripts (default: ~/.local/bin)"`
}

AliasRemoveCmd removes a single alias

func (*AliasRemoveCmd) Run

func (c *AliasRemoveCmd) Run() error

type AliasUninstallCmd

type AliasUninstallCmd struct {
	Box  string `arg:"" help:"Box name from charly.yml"`
	Dest string `long:"dest" default:"" help:"Directory for wrapper scripts (default: ~/.local/bin)"`
}

AliasUninstallCmd removes all aliases for an image

func (*AliasUninstallCmd) Run

func (c *AliasUninstallCmd) Run() error

Directories

Path Synopsis
cmd
serve command
Command serve is the OUT-OF-PROCESS entrypoint for the alias command plugin: dual-mode sdk.Main (serve OR CLI).
Command serve is the OUT-OF-PROCESS entrypoint for the alias command plugin: dual-mode sdk.Main (serve OR CLI).

Jump to

Keyboard shortcuts

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