cmd

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2026 License: MIT Imports: 52 Imported by: 0

Documentation

Overview

Copyright © 2025 NAME HERE <EMAIL ADDRESS>

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute

func Execute() (err error)

func NewCmdCredential added in v0.12.0

func NewCmdCredential() *cobra.Command

NewCmdCredential 创建凭据管理根命令

func NewCmdExec

func NewCmdExec() *cobra.Command

func NewCmdIdentity

func NewCmdIdentity() *cobra.Command

func NewCmdIdentityAdd

func NewCmdIdentityAdd() *cobra.Command

func NewCmdIdentityCredential added in v0.12.0

func NewCmdIdentityCredential() *cobra.Command

NewCmdIdentityCredential 创建 identity credential 子命令

func NewCmdIdentityDelete

func NewCmdIdentityDelete() *cobra.Command

func NewCmdIdentityEdit

func NewCmdIdentityEdit() *cobra.Command

func NewCmdIdentityList

func NewCmdIdentityList() *cobra.Command

func NewCmdInit added in v0.11.0

func NewCmdInit() *cobra.Command

NewCmdInit creates the command that initializes local XOps configuration.

func NewCmdMcp

func NewCmdMcp() *cobra.Command

func NewCmdPlay added in v0.9.0

func NewCmdPlay() *cobra.Command

func NewCmdScp

func NewCmdScp() *cobra.Command

func NewCmdSftp

func NewCmdSftp() *cobra.Command

func NewCmdSsh

func NewCmdSsh() *cobra.Command

func NewCmdTui added in v0.3.0

func NewCmdTui() *cobra.Command

Types

type DoctorCheckItem added in v0.12.0

type DoctorCheckItem struct {
	Name    string
	Status  string // "OK", "WARN", "FAIL"
	Message string
}

DoctorCheckItem 表示单项检查结果

type ExecOptions

type ExecOptions struct {
	SshOptions
	HostFile     string
	ShellFile    string
	Command      string
	Tag          string
	Exclude      []string
	TaskCount    int
	SuPwd        string
	Interactive  bool
	NoLoginShell bool
	Stream       bool
	OutDir       string
	// contains filtered or unexported fields
}

func NewExecOptions

func NewExecOptions() *ExecOptions

func (*ExecOptions) Complete

func (o *ExecOptions) Complete(cmd *cobra.Command, args []string) error

func (*ExecOptions) Run

func (o *ExecOptions) Run() error

func (*ExecOptions) RunContext added in v0.12.0

func (o *ExecOptions) RunContext(ctx context.Context) (retErr error)

RunContext executes the command on all selected hosts and propagates caller cancellation.

func (*ExecOptions) Validate

func (o *ExecOptions) Validate() error

type FirewallOptions

type FirewallOptions struct {
	SshOptions
	HostFile   string
	Protocol   string
	Reload     bool
	Remove     bool
	Zone       string
	Action     firewall.Action
	TaskCount  int
	StatusOnly bool
	Exclude    []string
}

func NewFirewallOptions

func NewFirewallOptions() *FirewallOptions

func (*FirewallOptions) RunOnHosts

func (o *FirewallOptions) RunOnHosts(ctx context.Context, action func(fw firewall.Firewall) (string, error)) error

type InitOptions added in v0.11.0

type InitOptions struct {
	ConfigPath       string
	KeyPath          string
	SSHConfigPath    string
	SSHConfigChanged bool
	SkipSSHImport    bool
}

InitOptions contains the filesystem-only settings for xops init.

func NewInitOptions added in v0.11.0

func NewInitOptions() *InitOptions

NewInitOptions creates initialization options with the default OpenSSH path.

func (*InitOptions) Run added in v0.11.0

func (o *InitOptions) Run() (initResult, error)

Run creates the local configuration and imports concrete OpenSSH hosts. It never performs network operations and never overwrites existing nodes.

func (*InitOptions) RunContext added in v0.12.0

func (o *InitOptions) RunContext(ctx context.Context) (initResult, error)

RunContext creates local configuration while preserving caller cancellation through durable configuration writes.

type PathInfo

type PathInfo struct {
	IsRemote bool
	User     string
	Host     string
	Port     uint16
	Path     string
}

type PlayOptions added in v0.9.0

type PlayOptions struct {
	FilePath    string
	Vars        []string // 格式: "key=value"
	Concurrency uint
	DryRun      bool
	Limit       string // 逗号分隔的节点名称,覆盖 Playbook 的 targets
	Sudo        bool
	Out         io.Writer
}

PlayOptions 保存 xops play 命令的所有选项

func NewPlayOptions added in v0.9.0

func NewPlayOptions() *PlayOptions

func (*PlayOptions) Run added in v0.9.0

func (o *PlayOptions) Run() error

Run 执行 Playbook。

func (*PlayOptions) RunContext added in v0.12.0

func (o *PlayOptions) RunContext(ctx context.Context) (retErr error)

RunContext executes the Playbook and propagates caller cancellation through target resolution, SSH connections, and step execution.

type ScpOptions

type ScpOptions struct {
	SshOptions
	Recursive   bool
	Progress    bool
	Force       bool
	NoOverwrite bool
	TaskCount   int
	ThreadCount int
	Source      string
	Dest        string
	HostFile    string
	Tag         string
	Exclude     []string
}

func NewScpOptions

func NewScpOptions() *ScpOptions

func (*ScpOptions) Complete

func (o *ScpOptions) Complete(_ *cobra.Command, args []string) error

func (*ScpOptions) Run

func (o *ScpOptions) Run() error

func (*ScpOptions) RunContext added in v0.12.0

func (o *ScpOptions) RunContext(ctx context.Context) (retErr error)

func (*ScpOptions) Validate

func (o *ScpOptions) Validate() error

type SftpOptions

type SftpOptions struct {
	SshOptions
	// contains filtered or unexported fields
}

func NewSftpOptions

func NewSftpOptions() *SftpOptions

func (*SftpOptions) Run

func (o *SftpOptions) Run() error

func (*SftpOptions) RunContext added in v0.12.0

func (o *SftpOptions) RunContext(ctx context.Context) (err error)

RunContext starts the interactive SFTP session and propagates caller cancellation.

type SshOptions

type SshOptions struct {
	Host            string
	Port            uint16
	User            string
	Password        string
	PasswordStdin   bool
	IdentityFile    string
	Passphrase      string
	PassphraseStdin bool
	Remember        string
	Sudo            bool
	Alias           string
	JumpHost        string
	Tags            []string
	LocalForwards   []string
	RemoteForwards  []string
	NoCmd           bool
	DynamicForward  string
	BgRun           bool
	StdinRedirect   bool

	Target config.ConnectionTarget

	Command string
	// contains filtered or unexported fields
}

func NewSshOptions

func NewSshOptions() *SshOptions

func (*SshOptions) Complete

func (o *SshOptions) Complete(cmd *cobra.Command, args []string) error

func (*SshOptions) Run

func (o *SshOptions) Run() error

func (*SshOptions) RunContext added in v0.12.0

func (o *SshOptions) RunContext(ctx context.Context) (err error)

RunContext starts the SSH operation and propagates caller cancellation.

func (*SshOptions) Validate

func (o *SshOptions) Validate() error

Directories

Path Synopsis
Package sftpshell implements the interactive presentation layer for SFTP.
Package sftpshell implements the interactive presentation layer for SFTP.

Jump to

Keyboard shortcuts

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