跳到主要内容

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

浏览文件

main.go

52 行 · 1.1 KB历史下载
1package main
2
3import (
4 "fmt"
5 "os"
6
7 "github.com/lima-vm/sshocker/pkg/version"
8 "github.com/sirupsen/logrus"
9 "github.com/urfave/cli/v2"
10)
11
12func newApp() *cli.App {
13 debug := false
14 app := cli.NewApp()
15 app.Name = "sshocker"
16 app.Usage = "ssh + reverse sshfs + port forwarder, in Docker-like CLI"
17 app.UsageText = "sshocker run -p LOCALIP:LOCALPORT:REMOTEPORT -v LOCALDIR:REMOTEDIR USER@HOST"
18 // we can't set app.Version because it conflicts with our `-v`
19
20 app.Flags = []cli.Flag{
21 &cli.BoolFlag{
22 Name: "debug",
23 Usage: "debug mode",
24 Destination: &debug,
25 },
26 &cli.BoolFlag{
27 Name: "version",
28 Usage: "print the version",
29 },
30 }
31 app.Flags = append(app.Flags, setHidden(runFlags, true)...)
32 app.Before = func(context *cli.Context) error {
33 if context.Bool("version") {
34 fmt.Printf("sshocker version %s\n", version.Version)
35 os.Exit(0)
36 return nil
37 }
38 if debug {
39 logrus.SetLevel(logrus.DebugLevel)
40 }
41 return nil
42 }
43 app.Commands = []*cli.Command{runCommand}
44 app.Action = runAction
45 return app
46}
47
48func main() {
49 if err := newApp().Run(os.Args); err != nil {
50 logrus.Fatal(err)
51 }
52}