cli

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package cli 實作 radb 的互動式命令列介面。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DeviceData

type DeviceData struct {
	Serial string
	State  string
	Lock   string
}

DeviceData 代表設備資訊。

type HostData

type HostData struct {
	HostID   string
	Hostname string
	Devices  []DeviceData
}

HostData 代表主機及其設備。

type IPCSender

type IPCSender func(daemon.IPCCommand) daemon.IPCResponse

IPCSender 是 IPC 指令發送函式的型別。

type Model

type Model struct {
	// contains filtered or unexported fields
}

Model 是 bubbletea 的主模型。

func NewModel

func NewModel(sendIPC IPCSender) Model

NewModel 建立互動式 bind 流程的模型。

func (Model) Init

func (m Model) Init() tea.Cmd

Init 初始化模型,載入主機列表。

func (Model) Update

func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update 處理訊息並更新模型狀態。

func (Model) View

func (m Model) View() string

View 渲染目前的畫面。

type Phase

type Phase int

Phase 代表互動流程的階段。

const (
	PhaseLoading      Phase = iota // 載入主機列表中
	PhaseSelectHost                // 選擇主機
	PhaseSelectDevice              // 選擇設備
	PhaseBinding                   // 綁定進行中
	PhaseResult                    // 顯示結果
)

Jump to

Keyboard shortcuts

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