linsk/cmd/root.go

43 lines
1.7 KiB
Go
Raw Normal View History

2023-08-25 15:12:19 +01:00
package cmd
import (
"os"
2023-08-25 16:54:58 +01:00
"log/slog"
2023-08-25 15:12:19 +01:00
"github.com/spf13/cobra"
)
var rootCmd = &cobra.Command{
2023-08-29 10:37:52 +01:00
Use: "linsk",
Short: "Access Linux-native file system infrastructure (including LVM and LUKS) on macOS and Linux. Powered by a lightweight Alpine Linux VM and FTP.",
Long: `Linsk is a utility that allows you to access Linux-native file system infrastructure, including device mapping technologies like LVM and LUKS without compromise on other operating systems that have little ` +
`to no support for Linux's wide range of file systems, mainly aiming macOS and Windows. Linsk does not reimplement any file system. Instead, Linsk ` +
`utilizes a lightweight Alpine Linux VM to tap into the native Linux software ecosystem. The files are then exposed to the host via fast and widely-supported FTP, ` +
`operating at near-hardware speeds.`,
2023-08-25 15:12:19 +01:00
}
func Execute() {
err := rootCmd.Execute()
if err != nil {
os.Exit(1)
}
}
2023-08-26 11:27:38 +01:00
var vmDebugFlag bool
2023-08-29 10:00:12 +01:00
var unrestrictedNetworkingFlag bool
2023-08-29 10:59:50 +01:00
var vmMemAllocFlag uint64
// TODO: Version command.
2023-08-26 11:27:38 +01:00
2023-08-25 15:12:19 +01:00
func init() {
2023-08-25 16:54:58 +01:00
slog.SetDefault(slog.New(slog.NewTextHandler(os.Stderr, nil)))
2023-08-25 15:12:19 +01:00
rootCmd.AddCommand(lsCmd)
2023-08-25 16:54:58 +01:00
rootCmd.AddCommand(runCmd)
2023-08-26 11:27:38 +01:00
rootCmd.AddCommand(shellCmd)
2023-08-29 10:59:50 +01:00
rootCmd.PersistentFlags().BoolVar(&vmDebugFlag, "vmdebug", false, "Enables the VM debug mode. This will open an accessible VM monitor. You can log in with root user and no password.")
rootCmd.PersistentFlags().BoolVar(&unrestrictedNetworkingFlag, "unrestricted-networking", false, "Enables unrestricted networking. This will allow the VM to connect to the internet.")
rootCmd.PersistentFlags().Uint64Var(&vmMemAllocFlag, "vm-mem-alloc", 512, "Specifies the VM memory allocation in KiB")
2023-08-25 15:12:19 +01:00
}