跳到主要内容

Claude Cage · 面向 Claude 的隔离开发环境,支持桌面工作台、多账号、远程部署与移动端连接。上游 Lee-xeo/Claude-Cage 完整源码镜像,非灵栈原创;主许可 MIT,第三方组件遵循各自许可。来源:https://github.com/Lee-xeo/Claude-Cage 。手动同步,不附带 Release 安装包。

浏览文件

managers_darwin.go

41 行 · 1.5 KB历史下载
1// SPDX-FileCopyrightText: Copyright The Lima Authors
2// SPDX-License-Identifier: Apache-2.0
3
4package autostart
5
6import "github.com/lima-vm/lima/v2/pkg/autostart/launchd"
7
8// Manager returns the autostart manager for Darwin.
9func Manager() autoStartManager {
10 return ManagerWith(true)
11}
12
13// ManagerWith returns the autostart manager for Darwin with the given options.
14func ManagerWith(keepAlive bool) autoStartManager {
15 extra := map[string]string{}
16 if keepAlive {
17 extra["KeepAlive"] = "true"
18 }
19 return &TemplateFileBasedManager{
20 filePath: launchd.GetPlistPath,
21 template: launchd.Template,
22 enabler: launchd.EnableDisableService,
23 autoStartedIdentifier: launchd.AutoStartedServiceName,
24 requestStart: launchd.RequestStart,
25 requestStop: launchd.RequestStop,
26 extraTemplateVars: extra,
27 }
28}
29
30// DaemonManager returns an autostart manager for rendering and tracking system LaunchDaemon plists.
31// The userName is the macOS user the daemon will run as.
32// Note: install/uninstall require privileged operations (writing to /Library/LaunchDaemons/ and
33// interacting with the system launchctl domain) that are handled by the `limactl daemon` CLI
34// command via sudo rather than by this manager directly.
35func DaemonManager(userName string) autoStartManager {
36 return &TemplateFileBasedManager{
37 filePath: launchd.GetDaemonPlistPath,
38 template: launchd.DaemonTemplate,
39 extraTemplateVars: map[string]string{"UserName": userName},
40 }
41}