跳到主要内容

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

浏览文件

sudoers.go

42 行 · 1.4 KB历史下载
1// SPDX-FileCopyrightText: Copyright The Lima Authors
2// SPDX-License-Identifier: Apache-2.0
3
4package main
5
6import (
7 "fmt"
8
9 "github.com/spf13/cobra"
10
11 "github.com/lima-vm/lima/v2/pkg/networks"
12)
13
14const socketVMNetURL = "https://lima-vm.io/docs/config/network/vmnet/#socket_vmnet"
15
16// newSudoersCommand is specific to macOS, but the help message is
17// compiled on Linux too, as depended by `make docsy`.
18// https://github.com/lima-vm/lima/issues/3436
19func newSudoersCommand() *cobra.Command {
20 sudoersCommand := &cobra.Command{
21 Use: "sudoers [--check [SUDOERSFILE-TO-CHECK]]",
22 Example: `
23To generate the /etc/sudoers.d/lima file:
24$ limactl sudoers | sudo tee /etc/sudoers.d/lima
25
26To validate the existing /etc/sudoers.d/lima file:
27$ limactl sudoers --check /etc/sudoers.d/lima
28`,
29 Short: "Generate the content of the /etc/sudoers.d/lima file",
30 Long: fmt.Sprintf(`Generate the content of the /etc/sudoers.d/lima file for enabling vmnet.framework support (socket_vmnet) on macOS.
31The content is written to stdout, NOT to the file.
32This command must not run as the root user.
33See %s for the usage.`, socketVMNetURL),
34 Args: WrapArgsError(cobra.MaximumNArgs(1)),
35 RunE: sudoersAction,
36 GroupID: advancedCommand,
37 }
38 cfgFile, _ := networks.ConfigFile()
39 sudoersCommand.Flags().Bool("check", false,
40 fmt.Sprintf("check that the sudoers file is up-to-date with %#q", cfgFile))
41 return sudoersCommand
42}